question_slug
stringlengths
3
77
title
stringlengths
1
183
slug
stringlengths
12
45
summary
stringlengths
1
160
author
stringlengths
2
30
certification
stringclasses
2 values
created_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
updated_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
hit_count
int64
0
10.6M
has_video
bool
2 classes
content
stringlengths
4
576k
upvotes
int64
0
11.5k
downvotes
int64
0
358
tags
stringlengths
2
193
comments
int64
0
2.56k
determine-if-two-strings-are-close
✅🤖| Full explanation with plenty of languages | 95.38% beaten | 🤖
full-explanation-with-plenty-of-language-osrs
Intuition\nThe goal of the problem is to determine if two strings, word1 and word2, are considered "close" based on certain operations. The allowed operations a
makarkananov
NORMAL
2024-01-14T11:57:18.576298+00:00
2024-01-14T12:02:04.102572+00:00
419
false
## Intuition\nThe goal of the problem is to determine if two strings, `word1` and `word2`, are considered "close" based on certain operations. The allowed operations are swapping any two existing characters and transforming every occurrence of one existing character into another existing character, and vice versa. \n\n...
4
0
['String', 'Python', 'C++', 'Java', 'Go', 'Python3', 'Rust', 'Ruby', 'JavaScript', 'C#']
1
determine-if-two-strings-are-close
Python3 *oneliner* linear solution O(n)
python3-oneliner-linear-solution-on-by-s-agsd
Intuition\n Describe your first thoughts on how to solve this problem. \nWhen tackling this problem, we need to focus on two key aspects:\n\n1) Character Flexib
sio13
NORMAL
2024-01-14T11:46:00.201246+00:00
2024-01-14T11:46:00.201278+00:00
145
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWhen tackling this problem, we need to focus on two key aspects:\n\n1) **Character Flexibility**: The problem allows for swapping elements, suggesting that the specific order of characters in the strings is irrelevant. This flexibility me...
4
0
['Python3']
0
determine-if-two-strings-are-close
Easy and Explained || Beats 100% || [Java/C++/Python/JavaScript]
easy-and-explained-beats-100-javacpython-lhfm
Intuition\n1. Operation 1 allows you to freely reorder the string.\n2. Operation 2 allows you to freely reassign the letters\' frequencies.\n3. That means every
Shivansu_7
NORMAL
2024-01-14T07:08:35.791104+00:00
2024-01-14T07:08:35.791139+00:00
131
false
# Intuition\n1. Operation 1 allows you to freely reorder the string.\n2. Operation 2 allows you to freely reassign the letters\' frequencies.\n3. That means every unique characters should have the same frequency in both the string.\n\n# Approach\n1. Counting Character Frequencies:\n - The code uses two integer array...
4
0
['C++', 'Java', 'Python3', 'JavaScript']
1
determine-if-two-strings-are-close
JAVA Solution Explained in HINDI
java-solution-explained-in-hindi-by-the_-vqmb
https://youtu.be/59KfskW5S8A\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F\n\nSubscribe link:- htt
The_elite
NORMAL
2024-01-14T05:30:06.697427+00:00
2024-01-14T05:30:06.697453+00:00
625
false
https://youtu.be/59KfskW5S8A\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F\n\nSubscribe link:- https://youtube.com/@quantumCode7?si=NzjWYmiCbqfFBUJE\n\nSubscribe Goal:- 100\nCurrent Subscriber:- 57\n\n# Code\n```\nclass Solution {\n public boolean closeSt...
4
0
['Java']
0
determine-if-two-strings-are-close
Faster than 98.3% || Simple C++ Solution || Time/Space : O(n)/O(1)
faster-than-983-simple-c-solution-timesp-8cky
Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n bool closeStrings(string w1, string w2) {\n
abhijeet5000kumar
NORMAL
2024-01-14T04:53:08.158032+00:00
2024-01-14T04:54:42.645830+00:00
159
false
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n bool closeStrings(string w1, string w2) {\n if(w1.size()!=w2.size()) return false;\n vector<int> freq1(26,0),freq2(26,0);\n for(auto it:w1) freq1[it-\'a\']++;\n for(auto...
4
0
['Array', 'String', 'Sorting', 'Counting', 'C++']
0
determine-if-two-strings-are-close
[ Python ] | Simple & Clean Code | Using Counter
python-simple-clean-code-using-counter-b-6jav
Code\n\nclass Solution:\n def closeStrings(self, s1: str, s2: str) -> bool:\n return set(s1) == set(s2) and Counter(Counter(s1).values()) == Counter(C
yash_visavadia
NORMAL
2023-04-24T01:40:16.437309+00:00
2023-04-24T01:40:16.437359+00:00
523
false
# Code\n```\nclass Solution:\n def closeStrings(self, s1: str, s2: str) -> bool:\n return set(s1) == set(s2) and Counter(Counter(s1).values()) == Counter(Counter(s2).values())\n\n```
4
0
['String', 'Python3']
0
determine-if-two-strings-are-close
Very easy C++ solution
very-easy-c-solution-by-chetanchaudhary-i8nu
Intuition\n Describe your first thoughts on how to solve this problem. \n\nIn order to be close , the length of word1 , word2 should be equal.\nif this conditio
chetanchaudhary
NORMAL
2022-12-22T13:13:42.165988+00:00
2022-12-22T13:13:42.166035+00:00
142
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nIn order to be close , the length of word1 , word2 should be equal.\nif this condition dont match simply return false.\n\nOperation 1 allows you to freely reorder the string.\nSo we will store the characters present in word1 , word2 . \...
4
0
['C++']
0
determine-if-two-strings-are-close
C++ || C# easy solutions.
c-c-easy-solutions-by-aloneguy-jgjk
Explanation of the Solutions!\n\n 1. Check if lengths match \uD83D\uDCDD\n If the lengths of word1 and word2 are not equal, return false right away, s
aloneguy
NORMAL
2022-12-02T16:35:10.373821+00:00
2024-10-12T16:27:34.391623+00:00
47
false
# Explanation of the Solutions!\n\n 1. Check if lengths match \uD83D\uDCDD\n If the lengths of word1 and word2 are not equal, return false right away, since no operations can make strings of different lengths equivalent.\n\n 2. Count occurrences of each character \uD83D\uDD22\n You create two maps, occu...
4
0
['String', 'C++', 'C#']
0
determine-if-two-strings-are-close
Java Most Simplest Solution
java-most-simplest-solution-by-janhvi__2-dp3b
\nclass Solution {\n public boolean closeStrings(String word1, String word2) {\n int[]str1 = new int[26];\n int[]str2 = new int[26];\n f
Janhvi__28
NORMAL
2022-12-02T15:29:08.368245+00:00
2022-12-02T15:29:08.368291+00:00
272
false
```\nclass Solution {\n public boolean closeStrings(String word1, String word2) {\n int[]str1 = new int[26];\n int[]str2 = new int[26];\n for(char c: word1.toCharArray())\n str1[c - \'a\']++;\n for(char c: word2.toCharArray()){\n str2[c - \'a\']++;\n if(str1[c...
4
0
['Java']
0
determine-if-two-strings-are-close
Easy||Explained in Detailed
easyexplained-in-detailed-by-kalashpatil-ygmu
\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n unordered_map<char,int> mp1; //A map to get the frequency of string 1\
kalashpatil
NORMAL
2022-12-02T07:31:42.576358+00:00
2022-12-02T07:31:42.576389+00:00
1,459
false
```\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n unordered_map<char,int> mp1; //A map to get the frequency of string 1\n unordered_map<char,int> mp2; //A map to get the frequency of string 2\n vector<int> v1;\n vector<int> v2;\n if(word1.size()==wo...
4
0
['String', 'C']
0
determine-if-two-strings-are-close
C++ || O(1) Time O(N) Space || Clean and Concise Code
c-o1-time-on-space-clean-and-concise-cod-qxwr
\n\n# Complexity\n- Time complexity: O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(26 + 26) = O(1)\n Add your space complexity here,
ashay028
NORMAL
2022-12-02T07:26:25.221664+00:00
2022-12-02T07:28:31.065173+00:00
62
false
\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(26 + 26) = O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n vector<int> f1(26) , f...
4
0
['C++']
0
determine-if-two-strings-are-close
C++ || HashMap || Simple Approach
c-hashmap-simple-approach-by-monk_man-nf70
\n# Approach\n Describe your approach to solving the problem. \nUsing HashMap and Vector\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here
monk_man
NORMAL
2022-12-02T06:42:04.237404+00:00
2022-12-02T06:42:04.237439+00:00
761
false
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUsing HashMap and Vector\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n ...
4
0
['Hash Table', 'C++']
1
determine-if-two-strings-are-close
C++ || Easy Sol. Faster Than 97.1% || TC : O(n) || Space : O(1)
c-easy-sol-faster-than-971-tc-on-space-o-3j8n
Complexity\n- Time complexity : O(n) , where n is word length\n\n- Space complexity : O(1)\n\n# Code\n\nclass Solution {\npublic:\n bool closeStrings(string
Khwaja_Abdul_Samad
NORMAL
2022-12-02T06:32:01.926161+00:00
2022-12-02T07:14:39.916338+00:00
215
false
# Complexity\n- Time complexity : O(n) , where n is word length\n\n- Space complexity : O(1)\n\n# Code\n```\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n \n if(word1.length() != word2.length())\n return false ;\n\n vector<int> f1(26 , 0) , f2(26 , 0);\n ...
4
0
['C++']
0
determine-if-two-strings-are-close
80% javascript really easy to understand solution
80-javascript-really-easy-to-understand-izlz2
Visit my youtube! Thank you!\nhttps://www.youtube.com/channel/UCkhEaNAOO8tig5NHqqxXIeg\n\n\nvar closeStrings = function(word1, word2) {\n if(word1.length !=
rlawnsqja850
NORMAL
2022-12-02T03:05:47.937249+00:00
2023-01-09T04:28:08.332310+00:00
528
false
Visit my youtube! Thank you!\nhttps://www.youtube.com/channel/UCkhEaNAOO8tig5NHqqxXIeg\n\n```\nvar closeStrings = function(word1, word2) {\n if(word1.length != word2.length) return false;\n \n let oneMap = {}\n let twoMap = {}\n \n for(let i= 0; i<word1.length;i++){\n oneMap[word1[i]] = oneMap[...
4
0
['JavaScript']
0
determine-if-two-strings-are-close
Clear and Concise cpp code - O(N)
clear-and-concise-cpp-code-on-by-bhavya_-9zix
Complexity\n- Time complexity: O(N)\n\n- Space complexity: O(N)\n\n# Code\n\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n
bhavya_kawatra13
NORMAL
2022-12-02T02:03:34.040950+00:00
2022-12-02T19:16:46.330942+00:00
384
false
# Complexity\n- Time complexity: O(N)\n\n- Space complexity: O(N)\n\n# Code\n```\nclass Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n vector<int>m(26,0),m1(26,0);\n for(auto i:word1)m[i-\'a\']++;\n for(auto i:word2)m1[i-\'a\']++;\n for(int i=0;i<26;i++){\n ...
4
0
['Sorting', 'C++']
1
determine-if-two-strings-are-close
go easy
go-easy-by-61kg-tq6y
Runtime: 55 ms, faster than 50.00% of Go online submissions for Determine if Two Strings Are Close.\nMemory Usage: 7 MB, less than 100.00% of Go online submissi
61kg
NORMAL
2022-12-02T01:41:01.250357+00:00
2022-12-02T01:41:01.250385+00:00
293
false
Runtime: 55 ms, faster than 50.00% of Go online submissions for Determine if Two Strings Are Close.\nMemory Usage: 7 MB, less than 100.00% of Go online submissions for Determine if Two Strings Are Close.\n\n```\nfunc closeStrings(word1 string, word2 string) bool {\n if len(word1) != len(word2) {\n return fals...
4
0
['Go']
1
determine-if-two-strings-are-close
JS frequency mapping + explanation O(n) O(1)
js-frequency-mapping-explanation-on-o1-b-ln8e
Intuition\nRule 1 means that the ordering of the letters is irrelevant.\nRule 2 means that the overall population of occurences has to be the same, but doesn\'t
crankyinmv
NORMAL
2022-12-02T01:02:04.651953+00:00
2022-12-02T01:02:04.651991+00:00
377
false
## Intuition\nRule 1 means that the ordering of the letters is irrelevant.\nRule 2 means that the overall population of occurences has to be the same, but doesn\'t have to map to the same letters.\n\nFor example `latter` has 4 letters (aler) occuring 1 time, and 1 (t) occuring 2 times. `taller` also has 4 letters (tae...
4
0
['JavaScript']
1
determine-if-two-strings-are-close
Need Only Map for Optimization as well as for easy understanding
need-only-map-for-optimization-as-well-a-l2yg
\nclass Solution {\n\tpublic boolean closeStrings(String word1, String word2) {\n\t\tHashMap<Character, Integer> map1 = new HashMap<>();\n\t\tfor (int i = 0; i
Aditya_jain_2584550188
NORMAL
2022-07-15T05:37:41.838144+00:00
2022-07-15T05:37:41.838207+00:00
207
false
```\nclass Solution {\n\tpublic boolean closeStrings(String word1, String word2) {\n\t\tHashMap<Character, Integer> map1 = new HashMap<>();\n\t\tfor (int i = 0; i < word1.length(); i++) {\n\t\t\tmap1.put(word1.charAt(i), map1.getOrDefault(word1.charAt(i), 0) + 1);\n\t\t}\n\n\t\tHashMap<Character, Integer> map2 = new Ha...
4
0
['Java']
0
determine-if-two-strings-are-close
Python Simplest Approach in One Line! Easy & Short, faster than 90%
python-simplest-approach-in-one-line-eas-z7br
So Simple - Faster than 90%\n\nclass Solution:\n def closeStrings(self, word1: str, word2: str) -> bool:\n w1 = Counter(word1)\n w2 = Counter(w
yehudisk
NORMAL
2021-01-22T09:42:09.790161+00:00
2021-01-22T09:59:09.272785+00:00
334
false
**So Simple - Faster than 90%**\n```\nclass Solution:\n def closeStrings(self, word1: str, word2: str) -> bool:\n w1 = Counter(word1)\n w2 = Counter(word2)\n \n letters1 = [x for x in w1.keys()]\n letters2 = [x for x in w2.keys()]\n \n freq1 = [x for x in w1.values()]...
4
0
['Python']
1
determine-if-two-strings-are-close
C# Simple counting O(N)
c-simple-counting-on-by-leoooooo-cy3j
\npublic class Solution {\n public bool CloseStrings(string word1, string word2) {\n if(word1.Length != word2.Length) return false;\n int[] a =
leoooooo
NORMAL
2020-11-15T05:21:46.791455+00:00
2020-11-15T05:21:46.791493+00:00
167
false
```\npublic class Solution {\n public bool CloseStrings(string word1, string word2) {\n if(word1.Length != word2.Length) return false;\n int[] a = new int[26];\n int[] b = new int[26];\n int maxLen = 0;\n for(int i = 0; i < word1.Length; i++)\n {\n maxLen = Math.M...
4
0
[]
0
determine-if-two-strings-are-close
[Javascript] HashMap
javascript-hashmap-by-alanchanghsnu-8zhf
Check whether two chars counting number hashMaps are same.\nEx1: abb vs baa\n->{a:1, b: 2} vs {a:2, b:1}\n-> {1:1, 2:1} vs {1:1, 2:1} -> true\n\nEx2: cabbba vs
alanchanghsnu
NORMAL
2020-11-15T04:04:37.257414+00:00
2020-11-15T04:09:51.364563+00:00
959
false
Check whether two chars counting number hashMaps are same.\nEx1: `abb` vs `baa`\n->`{a:1, b: 2}` vs `{a:2, b:1}`\n-> `{1:1, 2:1}` vs `{1:1, 2:1}` -> true\n\nEx2: `cabbba` vs `abbccc`\n-> `{a:2, b:3, c:1}` vs `{a:1, b:2, c:3}`\n-> `{1:1, 2:1, 3:1}` vs `{1:1, 2:1, 3:1}` -> true\n\n```\nvar closeStrings = function(word1, ...
4
0
['JavaScript']
1
determine-if-two-strings-are-close
Java 20 lines O(n) Solution
java-20-lines-on-solution-by-abhinavkuma-zvfo
\nclass Solution {\n public boolean closeStrings(String word1, String word2) {\n \n int freq1[] = new int[26];\n int freq2[] = new int[2
abhinavkumar08
NORMAL
2020-11-15T04:01:53.036819+00:00
2020-11-16T02:39:00.222439+00:00
774
false
```\nclass Solution {\n public boolean closeStrings(String word1, String word2) {\n \n int freq1[] = new int[26];\n int freq2[] = new int[26];\n int []visited1 = new int[26];\n int []visited2 = new int[26];\n \n for(char ch : word1.toCharArray()){\n freq1[c...
4
0
['Java']
1
determine-if-two-strings-are-close
Easiesest solution - will make you count this as easy problem
easiesest-solution-will-make-you-count-t-xijn
Approachif the length of both words or the set of both words don't match no way to match the close string. if you pass both the case just get a counter of word
ayushuh
NORMAL
2025-01-13T18:14:56.675296+00:00
2025-01-13T18:14:56.675296+00:00
578
false
# Approach <!-- Describe your approach to solving the problem. --> if the length of both words or the set of both words don't match no way to match the close string. if you pass both the case just get a counter of word and compare the sorted order if it does not match return false else true. # Complexity - Time complex...
3
0
['Python3']
1
determine-if-two-strings-are-close
Frequency Count and Meta-Frequency Matching
frequency-count-and-meta-frequency-match-janp
IntuitionThe strings can be made identical if they have the same set of characters, and the frequency of these characters can be rearranged to match.ApproachCou
lucifer_debug
NORMAL
2024-12-20T09:16:16.277425+00:00
2024-12-20T09:16:16.277425+00:00
153
false
# Intuition The strings can be made identical if they have the same set of characters, and the frequency of these characters can be rearranged to match. # Approach Count character frequencies for both strings using arrays mp1 and mp2. Verify that both strings use the same set of characters. Create meta-frequency arrays...
3
0
['C++']
0
determine-if-two-strings-are-close
Java Solution
java-solution-by-sardartirtho003-1cog
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach : \nThe first operation allows character swaps, and the second allows rema
sardartirtho003
NORMAL
2024-11-28T15:26:34.739879+00:00
2024-11-28T15:26:34.739913+00:00
309
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : \nThe first operation allows character swaps, and the second allows remapping character frequencies. Matching unique characters and sorted frequencies ensures the transformation is possible.\n<!-- Describe your approach to ...
3
0
['Java']
0
determine-if-two-strings-are-close
Solution By Dare2Solve | Detailed Explanation | Clean Code
solution-by-dare2solve-detailed-explanat-3ovp
Explanation []\nauthorslog.com/blog/BbN5R6bm5D\n\n# Code\n\ncpp []\nclass Solution {\npublic:\n bool checkIsUnique(unordered_set<char>& set1, unordered_set<c
Dare2Solve
NORMAL
2024-08-19T07:47:38.095267+00:00
2024-08-19T07:47:38.095284+00:00
347
false
```Explanation []\nauthorslog.com/blog/BbN5R6bm5D\n```\n# Code\n\n```cpp []\nclass Solution {\npublic:\n bool checkIsUnique(unordered_set<char>& set1, unordered_set<char>& set2) {\n for (char c : set1) {\n if (set2.find(c) == set2.end()) return false;\n }\n return true;\n }\n\n ...
3
0
['Hash Table', 'Sorting', 'Counting', 'Python', 'C++', 'Java', 'Python3', 'JavaScript']
0
determine-if-two-strings-are-close
Easiest python solution beating 98.33% people with explanation🤗
easiest-python-solution-beating-9833-peo-jref
\n\n\n1. Check if both the words are made up of same letters i.e. either of the words shouldn\'t have a letter that is not common. If not retrun False. if yes f
Parneetkaur2917
NORMAL
2024-07-22T17:32:02.157887+00:00
2024-07-22T17:32:02.157910+00:00
302
false
![image.png](https://assets.leetcode.com/users/images/189ff802-8639-4d91-a9f7-9a7a790ef68f_1721669496.3377306.png)\n\n\n1. Check if both the words are made up of same letters i.e. either of the words shouldn\'t have a letter that is not common. If not retrun False. if yes follow step 2.\n2. Now, count the number of tim...
3
0
['Python']
1
determine-if-two-strings-are-close
Python One-liner
python-one-liner-by-braveblc-ut72
Intuition\nBecause we can swap the position of any character, we only care about the frequency of what\'s in each string, as long as they have the same letters.
BraveBLC
NORMAL
2024-02-19T04:24:17.914125+00:00
2024-02-19T04:24:17.914157+00:00
147
false
# Intuition\nBecause we can swap the position of any character, we only care about the frequency of what\'s in each string, as long as they have the same letters. This indicates using a hashmap. \n\n\nBecause every occurence of one letter can be swapped, we only need to check if both strings have the same frequencies. ...
3
0
['Python', 'Python3']
0
determine-if-two-strings-are-close
Python easy solution !
python-easy-solution-by-abdelhalim1-p3hs
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem requires determining if two strings are "close" based on specific criteria
abdelhalim1
NORMAL
2024-01-14T20:22:43.965881+00:00
2024-01-14T20:22:43.965906+00:00
94
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem requires determining if two strings are "close" based on specific criteria related to length, character sets, and frequency distributions. My initial thoughts are to create frequency dictionaries for each word and compare thes...
3
0
['Python3']
0
determine-if-two-strings-are-close
✅ 🚀 51ms, 100% Speed, O(N log N). JS
51ms-100-speed-on-log-n-js-by-artme-om1u
Intuition\nTo determine if two strings word1 and word2 are close, the key is to understand that both operations (swapping any two characters or transforming occ
ArtMe
NORMAL
2024-01-14T19:09:42.796163+00:00
2024-01-14T19:09:42.796189+00:00
123
false
# Intuition\nTo determine if two strings `word1` and `word2` are close, the key is to understand that both operations (swapping any two characters or transforming occurrences of one character into another) do not affect the frequency of characters in the strings. Thus, two strings are close if they have the same charac...
3
0
['JavaScript']
0
minimum-number-of-operations-to-convert-time
C++ Greedy
c-greedy-by-lzl124631x-qocc
\nSee my latest update in repo LeetCode\n\n## Solution 1. Greedy\n\n Compute the time difference in seconds\n Greedily using 60, 15, 5, 1 operations. For each o
lzl124631x
NORMAL
2022-04-03T04:02:00.760476+00:00
2022-04-03T04:02:00.760530+00:00
5,114
false
\nSee my latest update in repo [LeetCode](https://github.com/lzl124631x/LeetCode)\n\n## Solution 1. Greedy\n\n* Compute the time difference in seconds\n* Greedily using `60, 15, 5, 1` operations. For each operation `op`, we use `diff / op` number of operations to turn `diff` to `diff % op`.\n\n```cpp\n// OJ: https://le...
83
0
[]
11
minimum-number-of-operations-to-convert-time
Convert to minutes
convert-to-minutes-by-votrubac-wgjo
Since we can only add minutes, the greedy approach would work.\n\nC++\ncpp \nint convertTime(string current, string correct) {\n auto toMin = [](string &s
votrubac
NORMAL
2022-04-03T04:01:57.877501+00:00
2022-04-03T07:03:23.919915+00:00
4,270
false
Since we can only add minutes, the greedy approach would work.\n\n**C++**\n```cpp \nint convertTime(string current, string correct) {\n auto toMin = [](string &s) { \n \xA0 \xA0 \xA0 \xA0return s[0] * 600 + s[1] * 60 + s[3] * 10 + s[4] ;\n };\n int d = toMin(correct) - toMin(current);\n return d / 60 + d...
61
0
['C']
21
minimum-number-of-operations-to-convert-time
⭐Easy Python Solution | Convert time to minutes
easy-python-solution-convert-time-to-min-oebs
Convert times into minutes and then the problem becomes simpler. \n2. To minimize the number of total operations we try to use the largest possible change from
ancoderr
NORMAL
2022-04-03T04:02:07.498074+00:00
2022-05-16T14:58:45.397605+00:00
3,051
false
1. Convert times into minutes and then the problem becomes simpler. \n2. To minimize the number of total operations we try to use the largest possible change from `[60,15,5,1]` till possible.\n```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n current_time = 60 * int(current[0:...
37
0
['Python', 'Python3']
4
minimum-number-of-operations-to-convert-time
Java | Loop | Easy To Understand
java-loop-easy-to-understand-by-sudhansh-f7ht
Here I am discussing my approach to this problem\nApproach:\n1. Convert both current time and correct time into minutes.\n2. Increase current time by 60min unti
SudhanshuMallick
NORMAL
2022-04-03T04:08:16.677164+00:00
2022-04-03T04:08:16.677190+00:00
2,238
false
**Here I am discussing my approach to this problem**\n**Approach:**\n1. Convert both **current time** and **correct time** into **minutes**.\n2. **Increase** **current time** by 60min until it becomes **just less or equal to correct time**.\n3. Similarly do the **same thing** with 15min, 5min, and 1min window.\n4. Coun...
23
0
['Java']
7
minimum-number-of-operations-to-convert-time
Short Java, 5 lines
short-java-5-lines-by-climberig-dzcp
```java\n public int convertTime(String current, String correct){\n Function parse = t -> Integer.parseInt(t.substring(0, 2)) * 60 + Integer.parseInt(t.s
climberig
NORMAL
2022-04-03T04:17:07.144773+00:00
2022-04-06T03:40:05.142927+00:00
2,312
false
```java\n public int convertTime(String current, String correct){\n Function<String, Integer> parse = t -> Integer.parseInt(t.substring(0, 2)) * 60 + Integer.parseInt(t.substring(3));\n int diff = parse.apply(correct) - parse.apply(current), ops[] = {60, 15, 5, 1}, r = 0;\n for(int i = 0; i < ops.l...
21
0
['Java']
4
minimum-number-of-operations-to-convert-time
C++ Solution 0ms 100% Faster 💫💫💫
c-solution-0ms-100-faster-by-himanshu_52-bech
"""\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hour1=(current[0]-\'0\')10+(current[1]-\'0\');\n int h
himanshu_52
NORMAL
2022-04-03T05:15:23.802203+00:00
2022-04-03T05:28:51.120775+00:00
1,008
false
"""\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hour1=(current[0]-\'0\')*10+(current[1]-\'0\');\n int hour2=(correct[0]-\'0\')*10+(correct[1]-\'0\');\n int minute1=(current[3]-\'0\')*10+(current[4]-\'0\');\n int minute2=(correct[3]-\'0\')*10+(corre...
13
0
['Math', 'C']
1
minimum-number-of-operations-to-convert-time
C++ Greedy Convert to minutes
c-greedy-convert-to-minutes-by-devendray-eyyn
\nclass Solution {\npublic:\n int convertTime(string current, string co) {\n \n string h1="";\n string m1="";\n string h2="";\n
devendrayadav_102
NORMAL
2022-04-03T04:31:46.170546+00:00
2022-04-03T04:31:46.170587+00:00
939
false
```\nclass Solution {\npublic:\n int convertTime(string current, string co) {\n \n string h1="";\n string m1="";\n string h2="";\n string m2="";\n \n h1+=current[0];\n h1+=current[1];\n \n m1+=current[3];\n m1+=current[4];\n \n ...
8
0
['C']
1
minimum-number-of-operations-to-convert-time
✅ cpp easy || Greedy || Explained || faster than 100%
cpp-easy-greedy-explained-faster-than-10-fv3g
```\n1. extract the hours and minutes from both the strings\n2. convert the strings to numbers\n3. convert both time time to minutes.\n4. calculate the minutes
namanvijay814
NORMAL
2022-04-03T04:05:28.977272+00:00
2022-04-03T04:14:50.593003+00:00
907
false
```\n1. extract the hours and minutes from both the strings\n2. convert the strings to numbers\n3. convert both time time to minutes.\n4. calculate the minutes difference.\n5. simply check minimum operations to make minutes equal to difference.\nclass Solution {\npublic:\n int convertTime(string a, string b) {\n ...
8
0
['C++']
4
minimum-number-of-operations-to-convert-time
🔥[Python 3] Convert to minutes and find parts using divmod, beats 85%
python-3-convert-to-minutes-and-find-par-efko
\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n def toMinutes(s):\n h, m = s.split(\':\')\n retu
yourick
NORMAL
2023-06-19T14:22:12.338008+00:00
2023-06-19T14:22:12.338028+00:00
427
false
```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n def toMinutes(s):\n h, m = s.split(\':\')\n return 60 * int(h) + int(m)\n \n minutes = toMinutes(correct) - toMinutes(current)\n hours, minutes = divmod(minutes, 60)\n quaters, ...
7
0
['Python', 'Python3']
0
minimum-number-of-operations-to-convert-time
[JavaScript] Clean O(N) Solution
javascript-clean-on-solution-by-yogipatu-mmge
\nvar convertTime = function(current, correct) {\n // 1. Seperate current and correct into Hours and Minutes\n const currentHoursMins = current.split(":")
YogiPaturu
NORMAL
2022-04-03T04:25:35.390190+00:00
2022-04-03T04:25:35.390235+00:00
291
false
```\nvar convertTime = function(current, correct) {\n // 1. Seperate current and correct into Hours and Minutes\n const currentHoursMins = current.split(":");\n const correctHoursMins = correct.split(":");\n \n // 2. Calculate difference in minutes\n let minDifference = ((correctHoursMins[1] - currentHou...
6
0
['Greedy', 'JavaScript']
3
minimum-number-of-operations-to-convert-time
simple and easy Python solution 😍❤️‍🔥
simple-and-easy-python-solution-by-shish-drwy
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook
shishirRsiam
NORMAL
2024-08-16T01:40:39.969234+00:00
2024-08-16T01:40:39.969261+00:00
212
false
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- ...
5
0
['String', 'Greedy', 'Python', 'Python3']
3
minimum-number-of-operations-to-convert-time
Solution in 6 languages | O(1) Time and O(1) Space Complexity |0ms | implementation |
solution-in-6-languages-o1-time-and-o1-s-yv0t
Pls upvote(\uD83E\uDD7A\uD83D\uDE48\uD83D\uDE0C). If you found it useful\n\nJust convert time of the day to minutes and iterate over 60,15,5,1 minutes to get th
harishdatla
NORMAL
2022-04-09T13:53:28.222449+00:00
2022-04-10T13:04:46.573701+00:00
530
false
**Pls upvote(\uD83E\uDD7A\uD83D\uDE48\uD83D\uDE0C). If you found it useful**\n\nJust convert time of the day to minutes and iterate over 60,15,5,1 minutes to get the number of ops.\n\nPlease suggest any improvements language wise or algorithmwise, im only well verse in c++,golang. I use the rest of languages on need by...
5
0
['C', 'Python', 'C++', 'Java', 'Go', 'Kotlin']
0
minimum-number-of-operations-to-convert-time
JavaScript Solution
javascript-solution-by-sronin-v5bu
Found this solution helpful? Consider showing support by upvoting this post.\nHave a question? Kindly leave a comment below.\nThank you and happy hacking!\n\nco
sronin
NORMAL
2022-04-08T01:38:24.157553+00:00
2022-04-09T01:36:54.161515+00:00
510
false
Found this solution helpful? Consider showing support by upvoting this post.\nHave a question? Kindly leave a comment below.\nThank you and happy hacking!\n```\nconst convertTime = (current, correct) => {\n if (current === correct) return 0\n\t\n let count = 0\n let currentInMins = parseInt(current.slice(3)) +...
5
0
['JavaScript']
2
minimum-number-of-operations-to-convert-time
Intutive || EasyToUnderstand || Greedy
intutive-easytounderstand-greedy-by-craz-x2s2
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int curr_hour = stoi(current.substr(0,2));\n int curr_min
crazy_zoker
NORMAL
2022-04-03T04:01:43.914077+00:00
2022-04-03T04:10:51.189044+00:00
399
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int curr_hour = stoi(current.substr(0,2));\n int curr_min = stoi(current.substr(3,2));\n int co_hour = stoi(correct.substr(0,2));\n int co_min = stoi(correct.substr(3,2));\n \n \n in...
5
0
[]
1
minimum-number-of-operations-to-convert-time
Python Easy
python-easy-by-true-detective-fkdf
first compute the hour and minute difference\n\nif minute difference is negative then we must change the diffs\n\nthen greedily subtract the remainder to 15, 5,
true-detective
NORMAL
2022-04-06T05:41:30.908199+00:00
2022-04-06T05:41:30.908245+00:00
358
false
first compute the hour and minute difference\n\nif minute difference is negative then we must change the diffs\n\nthen greedily subtract the remainder to 15, 5, 1 from minutes.\n```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n h1, m1 = current.split(\':\')\n h2, m2 = c...
4
0
[]
1
minimum-number-of-operations-to-convert-time
Rust solution
rust-solution-by-bigmih-j36w
\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n if current == correct {\n return 0;\n }\n\n
BigMih
NORMAL
2022-04-03T09:36:41.362297+00:00
2022-04-03T09:36:41.362344+00:00
90
false
```\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n if current == correct {\n return 0;\n }\n\n let to_num = |s: &str| -> i32 { s.parse().unwrap() };\n let (h2, m2) = (to_num(&correct[..2]), to_num(&correct[3..]));\n let (h1, m1) = (to...
4
0
[]
0
minimum-number-of-operations-to-convert-time
Java Time Conversion New
java-time-conversion-new-by-aditya_jain_-a4ji
\nclass Solution {\n public static int convertTime(String current, String correct) {\n\t\tint start = Integer.parseInt(current.substring(0, 2)) * 60 + Intege
Aditya_jain_2584550188
NORMAL
2022-04-03T06:15:16.541092+00:00
2022-04-03T06:15:16.541127+00:00
328
false
```\nclass Solution {\n public static int convertTime(String current, String correct) {\n\t\tint start = Integer.parseInt(current.substring(0, 2)) * 60 + Integer.parseInt(current.substring(3));\n\t\tint goal = Integer.parseInt(correct.substring(0, 2)) * 60 + Integer.parseInt(correct.substring(3));\n\n//\t\tSystem.ou...
4
0
['String', 'Java']
0
minimum-number-of-operations-to-convert-time
Python convert to minutes
python-convert-to-minutes-by-gauau-8g3l
\ndef convertTime(self, current: str, correct: str) -> int:\n\tans = 0\n\th, m = list(map(int, current.split(\':\')))\n\tnewH, newM = list(map(int, correct.spli
gauau
NORMAL
2022-04-03T04:07:59.396795+00:00
2022-04-03T04:11:39.335638+00:00
749
false
```\ndef convertTime(self, current: str, correct: str) -> int:\n\tans = 0\n\th, m = list(map(int, current.split(\':\')))\n\tnewH, newM = list(map(int, correct.split(\':\')))\n\td = 60*(newH - h) + newM - m\n\tfor x in [60, 15, 5, 1]:\n\t\tans += d//x\n\t\td %= x\n\treturn ans \n```
4
0
['Python', 'Python3']
1
minimum-number-of-operations-to-convert-time
javascript greedy 84ms
javascript-greedy-84ms-by-henrychen222-z7qd
Main idea: calculate minute difference, and divide 60, 15, 5, 1 respectively\n\nconst convertTime = (s, t) => {\n let [hs, ms] = op(s), [ht, mt] = op(t);\n
henrychen222
NORMAL
2022-04-03T04:04:37.080493+00:00
2022-04-03T04:05:56.176827+00:00
241
false
Main idea: calculate minute difference, and divide 60, 15, 5, 1 respectively\n```\nconst convertTime = (s, t) => {\n let [hs, ms] = op(s), [ht, mt] = op(t);\n let diff = Math.abs(hs * 60 + ms - (ht * 60 + mt));\n let res = 0;\n res += parseInt(diff / 60);\n diff %= 60;\n res += parseInt(diff / 15);\n ...
4
0
['Greedy', 'JavaScript']
0
minimum-number-of-operations-to-convert-time
Simple Elegant Solution With Explaination
simple-elegant-solution-with-explainatio-0v93
Idea:\nFor simplification, we can firstly convert current and correct to minutes. In this problem, we essentially need to bridge the gap between current and cor
mrunankmistry52
NORMAL
2022-04-03T04:04:35.348149+00:00
2022-04-03T04:04:35.348176+00:00
291
false
## Idea:\nFor simplification, we can firstly convert `current` and `correct` to minutes. In this problem, we essentially need to bridge the gap between `current` and `correct` by adding `[1, 5, 15, 60]` minutes to `current`. To be precise, we need to add `correct - current` number of minutes to \'current\'. Let `diff ...
4
0
['Python', 'Python3']
1
minimum-number-of-operations-to-convert-time
simple and easy C++ solution 😍❤️‍🔥
simple-and-easy-c-solution-by-shishirrsi-ehu4
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook
shishirRsiam
NORMAL
2024-08-16T01:27:32.138730+00:00
2024-08-16T01:27:32.138747+00:00
225
false
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n\n\n# Complexity\n- Time complexity: O(D), where D is the difference in minutes between cur and target.\n<!-- Add your time complex...
3
0
['String', 'Greedy', 'C++']
3
minimum-number-of-operations-to-convert-time
Minimum Number of Operations to Convert Time Solution in C++
minimum-number-of-operations-to-convert-6ynpu
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
The_Kunal_Singh
NORMAL
2023-04-06T19:45:54.298037+00:00
2023-04-27T16:52:26.683109+00:00
207
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$...
3
0
['C++']
0
minimum-number-of-operations-to-convert-time
Pyrhon3 | Simple | Beats 99.30% | Explained
pyrhon3-simple-beats-9930-explained-by-s-g0e9
The following code beats 99.30 % of python3 submissions\n\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n diff=(int(cor
shubhlaxh_porwal
NORMAL
2022-11-20T06:51:49.440496+00:00
2022-11-20T06:51:49.440533+00:00
15
false
The following code beats 99.30 % of python3 submissions\n```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n diff=(int(correct[:2])*60)+int(correct[3:])-((int(current[:2])*60)+int(current[3:]))\n count=0\n while diff!=0:\n if diff>=60:\n d...
3
0
['Greedy']
1
minimum-number-of-operations-to-convert-time
Java Optimized From 8 ms to 1ms
java-optimized-from-8-ms-to-1ms-by-tbekp-z1hr
Solution 3 | 8ms | 11% time | 69% memory\n\nclass Solution {\n public int convertTime(String current, String correct) {\n int curHour = Integer.parseI
tbekpro
NORMAL
2022-11-08T06:44:26.717022+00:00
2022-11-08T06:58:48.774310+00:00
767
false
# Solution 3 | 8ms | 11% time | 69% memory\n```\nclass Solution {\n public int convertTime(String current, String correct) {\n int curHour = Integer.parseInt(current.charAt(0) + "" + current.charAt(1));\n int curMin = Integer.parseInt(current.charAt(3) + "" + current.charAt(4));\n int corHour = ...
3
0
['Java']
0
minimum-number-of-operations-to-convert-time
c+ | 100% faster than all | easy
c-100-faster-than-all-easy-by-venomhighs-mkci
\n# Code\n\nclass Solution {\n int getTime(string &s) {\n return stoi(s.substr(0, 2)) * 60 + stoi(s.substr(3));\n }\npublic:\n int convertTime(s
venomhighs7
NORMAL
2022-10-02T16:24:19.971531+00:00
2022-10-02T16:24:19.971573+00:00
485
false
\n# Code\n```\nclass Solution {\n int getTime(string &s) {\n return stoi(s.substr(0, 2)) * 60 + stoi(s.substr(3));\n }\npublic:\n int convertTime(string current, string correct) {\n int diff = getTime(correct) - getTime(current), ops[4] = {60,15,5,1}, ans = 0;\n for (int op : ops) {\n ...
3
0
['C++']
0
minimum-number-of-operations-to-convert-time
Faster || Easy To Understand || C++ Code
faster-easy-to-understand-c-code-by-__kr-d5kv
Time Complexity : O(N)\n Space Complexity : O(1)*\n\n\nint convertTime(string current, string correct) {\n \n int hour1 = 0;\n \n ho
__KR_SHANU_IITG
NORMAL
2022-04-03T07:28:54.856988+00:00
2022-04-03T07:28:54.857021+00:00
253
false
* ***Time Complexity : O(N)***\n* ***Space Complexity : O(1)***\n\n```\nint convertTime(string current, string correct) {\n \n int hour1 = 0;\n \n hour1 = hour1 * 10 + current[0] - \'0\';\n \n hour1 = hour1 * 10 + current[1] - \'0\';\n \n int minute1 = 0;\n ...
3
0
['Math', 'Greedy', 'C']
1
minimum-number-of-operations-to-convert-time
Python O(1) Time
python-o1-time-by-amlanbtp-kvgm
```\nclass Solution:\n def convertTime(self, s: str, c: str) -> int:\n dif=(int(c[:2])60+int(c[3:]))-(int(s[:2])60+int(s[3:]))\n count=0\n
amlanbtp
NORMAL
2022-04-03T04:05:38.753455+00:00
2022-04-03T04:05:38.753493+00:00
339
false
```\nclass Solution:\n def convertTime(self, s: str, c: str) -> int:\n dif=(int(c[:2])*60+int(c[3:]))-(int(s[:2])*60+int(s[3:]))\n count=0\n print(dif)\n arr=[60,15,5,1]\n for x in arr:\n count+=dif//x\n dif=dif%x\n return count
3
0
['Python', 'Python3']
1
minimum-number-of-operations-to-convert-time
python/java easy to understand
pythonjava-easy-to-understand-by-akaghos-fh2u
\tclass Solution:\n\t\tdef convertTime(self, current: str, correct: str) -> int:\n\t\t\tcurrentTime = int(current[0:2]) * 60 + int(current[3:])\n\t\t\tcorrectTi
akaghosting
NORMAL
2022-04-03T04:01:21.625440+00:00
2022-04-03T04:01:21.625487+00:00
227
false
\tclass Solution:\n\t\tdef convertTime(self, current: str, correct: str) -> int:\n\t\t\tcurrentTime = int(current[0:2]) * 60 + int(current[3:])\n\t\t\tcorrectTime = int(correct[0:2]) * 60 + int(correct[3:])\n\t\t\tdiff = correctTime - currentTime\n\t\t\tres = 0\n\t\t\tfor time in (60, 15, 5, 1):\n\t\t\t\tres += diff //...
3
0
[]
0
minimum-number-of-operations-to-convert-time
leetcodedaybyday - Beats 100% with C++ and Python3
leetcodedaybyday-beats-100-with-c-and-py-5jwf
IntuitionThe problem requires determining the minimum number of operations needed to convert one time to another. The operations can only add fixed intervals (6
tuanlong1106
NORMAL
2024-12-25T09:00:03.349245+00:00
2024-12-25T09:00:03.349245+00:00
103
false
# Intuition The problem requires determining the minimum number of operations needed to convert one time to another. The operations can only add fixed intervals (60, 15, 5, or 1 minute). By leveraging the greedy algorithm, we can maximize the use of larger intervals first to minimize the total operations. # Approach 1...
2
0
['C++', 'Python3']
0
minimum-number-of-operations-to-convert-time
Fastest Solution (Java)
fastest-solution-java-by-talhah20343-z8a3
Code\n\nclass Solution{\n public int convertTime(String current, String correct){\n int a = Integer.parseInt(current.substring(0, 2));\n int b
talhah20343
NORMAL
2023-07-28T17:43:39.568892+00:00
2023-07-28T17:43:39.568915+00:00
306
false
# Code\n```\nclass Solution{\n public int convertTime(String current, String correct){\n int a = Integer.parseInt(current.substring(0, 2));\n int b = Integer.parseInt(current.substring(3));\n int x = a*60+b;\n int c = Integer.parseInt(correct.substring(0, 2));\n int d = Integer.par...
2
0
['Java']
0
minimum-number-of-operations-to-convert-time
Beat 99.29% 22ms Python3 easy solution
beat-9929-22ms-python3-easy-solution-by-mnx6x
\n# Code\n\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n current, correct = current.replace(\':\',\'\'), correct.repl
amitpandit03
NORMAL
2023-03-12T18:07:28.259422+00:00
2023-03-12T18:08:39.416014+00:00
240
false
\n# Code\n```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n current, correct = current.replace(\':\',\'\'), correct.replace(\':\',\'\')\n a, count = (int(correct[:2]) * 60 + int(correct[2:])) - (int(current[:2]) * 60 + int(current[2:])), 0\n for i in [60, 15, 5, ...
2
0
['String', 'Greedy', 'Python3']
0
minimum-number-of-operations-to-convert-time
Simple JAVA Solution || Greedy
simple-java-solution-greedy-by-prachiigo-w4wg
\nclass Solution {\n public int convertTime(String current, String correct) {\n int currentTimeInMin = getMinutes(current);\n int correctTimeIn
prachiigoyal
NORMAL
2022-09-23T15:50:20.455861+00:00
2022-09-23T15:50:20.455914+00:00
333
false
```\nclass Solution {\n public int convertTime(String current, String correct) {\n int currentTimeInMin = getMinutes(current);\n int correctTimeInMin = getMinutes(correct);\n \n int diff=correctTimeInMin-currentTimeInMin;\n int[] denominations={60,15,5,1};\n int count=0;\n ...
2
0
['Greedy', 'Java']
0
minimum-number-of-operations-to-convert-time
Easy Python solution
easy-python-solution-by-vistrit-fuxi
\ndef convertTime(self, current: str, correct: str) -> int:\n d=(int(correct[:2])*60+int(correct[3:]))-(int(current[:2])*60+int(current[3:]))\n re
vistrit
NORMAL
2022-06-04T13:48:52.731091+00:00
2022-06-04T13:48:52.731125+00:00
319
false
```\ndef convertTime(self, current: str, correct: str) -> int:\n d=(int(correct[:2])*60+int(correct[3:]))-(int(current[:2])*60+int(current[3:]))\n return d//60+(d%60)//15+((d%60)%15)//5+((d%60)%15)%5\n```
2
1
['Python', 'Python3']
0
minimum-number-of-operations-to-convert-time
Rust, parse(), %, O(n)
rust-parse-on-by-goodgoodwish-p97p
parse, unwrap_or.\n\n\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n let h = &current[..2].parse::<i32>().map_or(
goodgoodwish
NORMAL
2022-04-03T22:29:04.740069+00:00
2022-04-03T22:29:04.740106+00:00
60
false
parse, unwrap_or.\n\n```\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n let h = &current[..2].parse::<i32>().map_or(0, |x|x);\n let m = &current[3..].parse::<i32>().unwrap_or(0);\n let start = h*60 + m;\n\n let h = &correct[..2].parse::<i32>().map_or(0...
2
0
['Rust']
0
minimum-number-of-operations-to-convert-time
[C++] || Convert given times to minutes and think in greedy way
c-convert-given-times-to-minutes-and-thi-mfzo
\nclass Solution {\npublic:\n int convertToMinutes(string current){\n int minutes = 0;\n //add hrs after converting to minutes 02:35 ->02*60 =
shm_47
NORMAL
2022-04-03T20:11:51.503586+00:00
2022-04-03T20:11:51.503614+00:00
81
false
```\nclass Solution {\npublic:\n int convertToMinutes(string current){\n int minutes = 0;\n //add hrs after converting to minutes 02:35 ->02*60 = 120\n int i;\n string hrs = "";\n for(i=0; i<=1; i++){\n hrs += current[i];\n }\n int hrI = stoi(hrs); //"02...
2
0
['Greedy']
0
minimum-number-of-operations-to-convert-time
Java Greedy | Easy Understanding
java-greedy-easy-understanding-by-mudit1-wm9n
\nclass Solution {\n public int convertTime(String current, String correct) {\n // convert current time to minutes\n String[] current_time = cu
mudit19258
NORMAL
2022-04-03T09:27:53.716433+00:00
2022-04-03T09:27:53.716472+00:00
276
false
```\nclass Solution {\n public int convertTime(String current, String correct) {\n // convert current time to minutes\n String[] current_time = current.split(":");\n int current_hour = Integer.parseInt(current_time[0]);\n current_hour *= 60;\n int current_min = Integer.parseInt(cur...
2
0
['Greedy', 'Java']
1
minimum-number-of-operations-to-convert-time
C++ | Easy O(N) solution | maths
c-easy-on-solution-maths-by-yash2arma-pxoi
Please upvote if it helps :)\nCode:\n\nclass Solution {\npublic:\n int convertTime(string current, string correct) \n {\n int cur_hrs = stoi(curren
Yash2arma
NORMAL
2022-04-03T05:00:43.596001+00:00
2022-04-03T05:00:43.596035+00:00
175
false
**Please upvote if it helps :)**\n**Code:**\n```\nclass Solution {\npublic:\n int convertTime(string current, string correct) \n {\n int cur_hrs = stoi(current.substr(0,2)), cur_min = stoi(current.substr(3,4));\n int cor_hrs = stoi(correct.substr(0,2)), cor_min = stoi(correct.substr(3,4));\n\n ...
2
0
['Math', 'String', 'C', 'C++']
0
minimum-number-of-operations-to-convert-time
Go / GoLang | Time: O(1) / 0 ms / 100% | Space: O(1) / 1.9 MB / 100%
go-golang-time-o1-0-ms-100-space-o1-19-m-qtfo
\nfunc convertTime(current string, correct string) int {\n currentHour, _ := strconv.Atoi(current[:2])\n correctHour, _ := strconv.Atoi(correct[:2])\n
aristorinjuang
NORMAL
2022-04-03T04:47:09.905790+00:00
2022-04-03T04:47:09.905853+00:00
138
false
```\nfunc convertTime(current string, correct string) int {\n currentHour, _ := strconv.Atoi(current[:2])\n correctHour, _ := strconv.Atoi(correct[:2])\n currentMinutes, _ := strconv.Atoi(current[3:])\n correctMinutes, _ := strconv.Atoi(correct[3:])\n result, minutes := 0, (correctHour - currentHour) * 6...
2
0
['Greedy', 'Go']
0
minimum-number-of-operations-to-convert-time
[c++] || String || maths
c-string-maths-by-4byx-3eso
\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hd = stoi(correct.substr(0,2)) - stoi(current.substr(0,2));\n
4byx
NORMAL
2022-04-03T04:03:00.636340+00:00
2022-04-03T04:03:00.636388+00:00
212
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hd = stoi(correct.substr(0,2)) - stoi(current.substr(0,2));\n int ans = 0;\n ans += hd;\n \n int ct = stoi(correct.substr(3,2)) - stoi(current.substr(3,2));\n \n if(ct > 0){\n ...
2
0
[]
0
minimum-number-of-operations-to-convert-time
C++ Easy Understanding
c-easy-understanding-by-mayanksamadhiya1-xlka
\nclass Solution {\npublic:\n int convertTime(string current, string correct) \n {\n // extractig the minute & hours value from given strings\n
mayanksamadhiya12345
NORMAL
2022-04-03T04:01:09.768992+00:00
2022-04-03T04:01:09.769039+00:00
131
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) \n {\n // extractig the minute & hours value from given strings\n int cur_hrs = stoi(current.substr(0,2));\n int cur_min = stoi(current.substr(3,4));\n int cor_hrs = stoi(correct.substr(0,2));\n int...
2
0
[]
0
minimum-number-of-operations-to-convert-time
Python 1-liner
python-1-liner-by-shreyansh94-vyk6
Algorithm:\n1. Split the strings at : and convert each element to int().\n2. If correct time minutes is less than current time minutes, subtract 1 from correct
shreyansh94
NORMAL
2022-04-03T04:00:49.052888+00:00
2022-04-03T04:02:39.467200+00:00
245
false
Algorithm:\n1. Split the strings at `:` and convert each element to `int()`.\n2. If `correct` time minutes is `less` than `current` time minutes, `subtract 1` from `correct` time hours and `add 60` to `correct` time minutes.\n3. return `difference` between the time hours `plus` the number of operation to make `correct`...
2
1
['Python']
0
minimum-number-of-operations-to-convert-time
Easy Java Solution in O(1) Time complexity
easy-java-solution-in-o1-time-complexity-5lpi
IntuitionWe are given two time strings (current and correct) in the format "HH:mm", and we need to determine the minimum number of operations to convert the cur
vivekvinay96254
NORMAL
2025-02-18T14:01:14.135638+00:00
2025-02-18T14:01:14.135638+00:00
89
false
# Intuition <!-- Describe your first thoughts on how to solve this problem. --> We are given two time strings (current and correct) in the format "HH:mm", and we need to determine the minimum number of operations to convert the current time to the correct time. Each operation can be one of the following: Add 60 minute...
1
0
['Java']
0
minimum-number-of-operations-to-convert-time
2D-dp - java
2d-dp-java-by-kartheek_gurram-m3cj
Intuition\n Describe your first thoughts on how to solve this problem. \nDP-Unbounded knapsack approach\n\n# Approach\n Describe your approach to solving the pr
kartheek_gurram
NORMAL
2024-10-21T13:54:54.507401+00:00
2024-10-21T13:54:54.507428+00:00
17
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nDP-Unbounded knapsack approach\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space c...
1
0
['Dynamic Programming', 'Java']
0
minimum-number-of-operations-to-convert-time
Easy 100% beats💯💯💯👍🏻👍🏻
easy-100-beats-by-israatumeh9-st72
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
israatumeh9
NORMAL
2024-09-25T17:43:08.291256+00:00
2024-09-25T17:43:08.291280+00:00
46
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['C++']
0
minimum-number-of-operations-to-convert-time
2224 Easy Java Solution
2224-easy-java-solution-by-roger2023-o24k
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
roger2023
NORMAL
2024-07-27T14:26:59.527644+00:00
2024-07-27T14:26:59.527666+00:00
189
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['Array', 'String', 'Java']
2
minimum-number-of-operations-to-convert-time
Recursive JS Solution to Convert Time With Minimal Steps
recursive-js-solution-to-convert-time-wi-eary
Intuition\nThe problem requires converting a given current time to a correct time using the fewest number of operations, where each operation can increase the t
OscarQ5
NORMAL
2024-06-30T22:15:32.685890+00:00
2024-06-30T22:15:32.685907+00:00
45
false
# Intuition\nThe problem requires converting a given current time to a correct time using the fewest number of operations, where each operation can increase the time by 1, 5, 15, or 60 minutes. To solve, we can convert both current and correct times to total minutes and then calculate the difference. The difference is ...
1
0
['JavaScript']
0
minimum-number-of-operations-to-convert-time
Simple java code 1 ms beats 89.73 %
simple-java-code-1-ms-beats-8973-by-arob-o33o
\n# Complexity\n\n# Code\n\nclass Solution {\n public int convertTime(String current, String correct) {\n int a = Integer.parseInt(current.substring(0
Arobh
NORMAL
2024-03-25T03:10:37.823708+00:00
2024-03-25T03:10:37.823741+00:00
97
false
\n# Complexity\n![image.png](https://assets.leetcode.com/users/images/dce0a3e7-2468-41e2-9e18-8dfce639a2dd_1711336215.8592305.png)\n# Code\n```\nclass Solution {\n public int convertTime(String current, String correct) {\n int a = Integer.parseInt(current.substring(0,2))*60 + Integer.parseInt(current.substrin...
1
0
['String', 'Greedy', 'Java']
0
minimum-number-of-operations-to-convert-time
Java solutoin Beats 94% easy to understand
java-solutoin-beats-94-easy-to-understan-02ie
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Ali-Aljufairi
NORMAL
2023-11-05T06:34:44.078880+00:00
2023-11-05T06:34:44.078909+00:00
267
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['Java']
0
minimum-number-of-operations-to-convert-time
Short and simple: convert to minutes
short-and-simple-convert-to-minutes-by-s-6duk
Complexity\n- Time complexity: O(n)\n- Space complexity: O(1)\n\n# Code\n\nvar convertTime = function(current, correct) {\n const steps = [60, 15, 5, 1];\n
stuymedova
NORMAL
2023-09-25T08:42:47.226729+00:00
2023-09-25T08:42:47.226755+00:00
8
false
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```\nvar convertTime = function(current, correct) {\n const steps = [60, 15, 5, 1];\n const currentTimeInMinutes = convertToMinutes(current);\n const correctTimeInMinutes = convertToMinutes(correct);\n let diff = correctTimeI...
1
0
['JavaScript']
0
minimum-number-of-operations-to-convert-time
✅✔️100% Beat || Easy to understand C++ Solution || Greedy ✈️✈️✈️✈️✈️
100-beat-easy-to-understand-c-solution-g-wxlr
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
ajay_1134
NORMAL
2023-06-22T07:43:20.132762+00:00
2023-06-22T07:43:20.132782+00:00
311
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
1
0
['String', 'Greedy', 'C++']
1
minimum-number-of-operations-to-convert-time
Easy || C++
easy-c-by-priya0498-wfbr
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n \n int currentHours = 0;\n int currentMinute = 0;\n
priya0498
NORMAL
2023-06-03T08:26:28.490730+00:00
2023-06-03T08:26:28.490760+00:00
10
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n \n int currentHours = 0;\n int currentMinute = 0;\n int correctHours = 0;\n int correctMinute = 0; \n \n int i = 0;\n \n while(current[i] != \':\') {\n curr...
1
0
[]
0
minimum-number-of-operations-to-convert-time
Swift 100% time complexity
swift-100-time-complexity-by-adamsmsher-nmxf
Intuition\nFigure out how to get the difference. \nUse minutes because its the units used per operation.\n\n# Approach\nConvert to minutes, get difference, divi
AdamSmsher
NORMAL
2022-11-04T22:39:28.740773+00:00
2022-11-04T22:42:49.261774+00:00
65
false
# Intuition\nFigure out how to get the difference. \nUse minutes because its the units used per operation.\n\n# Approach\nConvert to minutes, get difference, divide remaining by minutes\n\n# Complexity\n- Time complexity:\no(n)\n\n- Space complexity:\no(n)\n\n# Code\n```\nclass Solution {\n func convertTime(_ curren...
1
0
['Swift']
1
minimum-number-of-operations-to-convert-time
Minimum memory || 81% faster MATH INTEGER
minimum-memory-81-faster-math-integer-by-wmh7
Clean code and faster!\n\n\n\n\nclass Solution {\n public int convertTime(String current, String correct) {\n int x = Integer.parseInt(current.substri
Dilshod_Rich
NORMAL
2022-10-27T12:30:41.013936+00:00
2022-10-27T12:30:41.013974+00:00
36
false
Clean code and faster!\n\n\n\n\nclass Solution {\n public int convertTime(String current, String correct) {\n int x = Integer.parseInt(current.substring(0,2));\n int y = Integer.parseInt(correct.substring(0,2));\n\n int x1 = Integer.parseInt(current.substring(3));\n int x2 = Integer.parse...
1
0
['Math', 'Java']
0
minimum-number-of-operations-to-convert-time
c++||Manual code||100% faster
cmanual-code100-faster-by-nikhil909-exuy
class Solution {\npublic\n\n//we can also use substr() and stoi() functions here ,I have done that manually coz given string wasn\'t so complex\n\n int toMi
nikhil909
NORMAL
2022-10-14T19:56:56.086943+00:00
2022-10-14T20:02:55.827664+00:00
357
false
class Solution {\npublic\n\n//we can also use substr() and stoi() functions here ,I have done that manually coz given string wasn\'t so complex\n\n int toMinute(string curr){\n int mi=0; \n mi=mi+curr[0]-\'0\'; mi*=10;\n mi=mi+curr[1]-\'0\';\n mi*=60;\n int a=0;\n a=a+cu...
1
0
['C', 'C++']
1
minimum-number-of-operations-to-convert-time
100% fast (convert into min)
100-fast-convert-into-min-by-bhutanibhan-dzcx
upvote\n\n int convertTime(string cur, string cor) {\n int curr = ((cur[0]-\'0\')*10+cur[1]-\'0\')*60+(cur[3]-\'0\')*10+cur[4]-\'0\';\n int cor
bhutanibhanu
NORMAL
2022-09-29T02:03:03.705207+00:00
2022-09-29T02:03:03.705253+00:00
402
false
upvote\n```\n int convertTime(string cur, string cor) {\n int curr = ((cur[0]-\'0\')*10+cur[1]-\'0\')*60+(cur[3]-\'0\')*10+cur[4]-\'0\';\n int corr = ((cor[0]-\'0\')*10+cor[1]-\'0\')*60+(cor[3]-\'0\')*10+cor[4]-\'0\';\n int ops =0, rem=corr-curr;\n while(rem>=60){\n rem -= 60;\...
1
0
['C']
0
minimum-number-of-operations-to-convert-time
Easiest Shortest Simplest C++ solution
easiest-shortest-simplest-c-solution-by-i7x46
Convert the strings to int time in minutes and then find the difference. Apply simple maths!\n\n\tclass Solution {\n\tpublic:\n\t\tint convertTime(string curren
ansh1701
NORMAL
2022-09-14T17:53:36.658499+00:00
2022-09-14T17:57:20.507344+00:00
256
false
Convert the strings to int time in minutes and then find the difference. Apply simple maths!\n\n\tclass Solution {\n\tpublic:\n\t\tint convertTime(string current, string correct) {\n\t\t\tint ftime = (stoi(current.substr(0,2))) * 60 + (stoi(current.substr(3,current.size())));\n\t\t\tint ltime = (stoi(correct.substr(0,2...
1
0
['C']
0
minimum-number-of-operations-to-convert-time
C++ | Easily Understandable | Brute-Force | Greedy
c-easily-understandable-brute-force-gree-obds
\nTime: O(Log minute) Space: O(1)\n\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int m1=10*(current[3]-\'0\')+(cu
silicon_
NORMAL
2022-08-18T16:38:45.083760+00:00
2022-08-18T16:38:45.083809+00:00
118
false
```\nTime: O(Log minute) Space: O(1)\n\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int m1=10*(current[3]-\'0\')+(current[4]-\'0\'),\n m2=10*(correct[3]-\'0\')+(correct[4]-\'0\');\n int k=m2-m1;\n int h1=10*(current[0]-\'0\')+(current[1]-\'0\'),\n ...
1
0
['Greedy', 'C']
0
minimum-number-of-operations-to-convert-time
100% Faster C++ Solution || Easy to understand
100-faster-c-solution-easy-to-understand-se23
\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hours1=stoi(current.substr(0,2));\n int hours2=stoi(corre
sticktrick3181
NORMAL
2022-08-11T20:51:53.126160+00:00
2022-08-11T20:51:53.126190+00:00
200
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int hours1=stoi(current.substr(0,2));\n int hours2=stoi(correct.substr(0,2));\n int min1=stoi(current.substr(3,2));\n int min2=stoi(correct.substr(3,2));\n int mins=((60-min1)+(min2))<60?abs((hours...
1
0
['C++']
0
minimum-number-of-operations-to-convert-time
C++ (0ms) and Java (1ms) | Easy Understanding
c-0ms-and-java-1ms-easy-understanding-by-7w7b
C++ Solution\n\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int ret=0, digit=1, cur=0, cor=0, hour=1, i;\n
keremtan
NORMAL
2022-08-10T12:41:51.332240+00:00
2022-08-10T12:41:51.332286+00:00
202
false
**C++ Solution**\n```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int ret=0, digit=1, cur=0, cor=0, hour=1, i;\n int t[] = {59,14,4,0};\n for(i = current.size()-1; i>-1; i--){\n if(58!=current[i]){\n cur += (current[i]-48)*digit*hour...
1
0
['C', 'Java']
0
minimum-number-of-operations-to-convert-time
Easiest Java Solution | T=O(1), S=O(1)
easiest-java-solution-to1-so1-by-ayushi9-20wz
\n\n\n\npublic int convertTime(String current, String correct) {\n String[] start = current.split(":");\n int startMins = Integer.valueOf(start[0]
ayushi9
NORMAL
2022-08-03T10:54:52.818725+00:00
2022-08-03T10:54:52.818752+00:00
124
false
\n\n\n```\npublic int convertTime(String current, String correct) {\n String[] start = current.split(":");\n int startMins = Integer.valueOf(start[0])*60+Integer.valueOf(start[1]);\n \n String[] target = correct.split(":");\n int targetMins = Integer.valueOf(target[0])*60+Integer.valu...
1
0
['Java']
0
minimum-number-of-operations-to-convert-time
Greedy || 100% Faster ||0ms
greedy-100-faster-0ms-by-hs873251-rrqv
\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int res=0;\n string ans=current.substr(0,2);\n string
hs873251
NORMAL
2022-07-29T03:30:18.056751+00:00
2022-07-29T03:30:18.056777+00:00
192
false
```\nclass Solution {\npublic:\n int convertTime(string current, string correct) {\n int res=0;\n string ans=current.substr(0,2);\n string ans1=current.substr(3,5);\n int a1=stoi(ans)*60;\n int a2=stoi(ans1);\n string st=correct.substr(0,2);\n string st1=correct.subs...
1
0
['Greedy', 'C', 'C++']
0
minimum-number-of-operations-to-convert-time
[LeetCode The Hard Way] Greedy || Explanation
leetcode-the-hard-way-greedy-explanation-5efq
Please check out LeetCode The Hard Way for more solution explanations and tutorials. If you like it, please give a star and watch my Github Repository.\n\n---\n
__wkw__
NORMAL
2022-07-19T14:58:04.771797+00:00
2022-07-19T15:02:36.144535+00:00
124
false
Please check out [LeetCode The Hard Way](https://wingkwong.github.io/leetcode-the-hard-way/) for more solution explanations and tutorials. If you like it, please give a star and watch my [Github Repository](https://github.com/wingkwong/leetcode-the-hard-way).\n\n---\n\nChoosing `60` 1 time is better than choosing `15` ...
1
0
['Greedy', 'C', 'C++']
0
minimum-number-of-operations-to-convert-time
Java: Difference in minutes
java-difference-in-minutes-by-dpksamir-2gfu
\npublic int convertTime(String current, String correct) {\n String[] currentTime = current.split(":");\n String[] correctTime = correct.split(":"
dpksamir
NORMAL
2022-07-18T14:05:37.355078+00:00
2022-07-18T14:05:37.355126+00:00
54
false
```\npublic int convertTime(String current, String correct) {\n String[] currentTime = current.split(":");\n String[] correctTime = correct.split(":");\n \n int correctMin = Integer.parseInt(correctTime[0]) * 60 + Integer.parseInt(correctTime[1]);\n int currentMin = Integer.parseInt(c...
1
0
[]
1
minimum-number-of-operations-to-convert-time
rust
rust-by-kennylong-6wwb
rust\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n let current: Vec<_> = current.split(":").collect();\n
kennylong
NORMAL
2022-07-07T13:55:47.672576+00:00
2022-07-07T13:55:47.672628+00:00
24
false
```rust\nimpl Solution {\n pub fn convert_time(current: String, correct: String) -> i32 {\n let current: Vec<_> = current.split(":").collect();\n let correct: Vec<_> = correct.split(":").collect();\n let start0: i32 = current[0].parse().unwrap();\n let start1: i32 = current[1].parse().unw...
1
0
['Rust']
0
minimum-number-of-operations-to-convert-time
My 2ms Easy to understand JAVA code
my-2ms-easy-to-understand-java-code-by-p-3qi6
```\nclass Solution \n{\n public int convertTime(String current, String correct) \n {\n int cur_hou = Integer.parseInt(current.substring(0,2));\n
Pranjal_Dwivedi
NORMAL
2022-06-27T04:39:59.183392+00:00
2022-06-27T04:39:59.183446+00:00
59
false
```\nclass Solution \n{\n public int convertTime(String current, String correct) \n {\n int cur_hou = Integer.parseInt(current.substring(0,2));\n int cur_min = Integer.parseInt(current.substring(3,5));\n int cur = (cur_hou*60)+cur_min; //150\n \n int cor_hou = Integer.pa...
1
0
['Java']
0
minimum-number-of-operations-to-convert-time
Why greedy works here?
why-greedy-works-here-by-r_fadeup-5hyf
I know there is papaer regarding cannonical sequence of numbers which can identify if a problem like this can be solved using Greedy way. https://arxiv.org/pdf/
r_fadeup
NORMAL
2022-05-02T20:56:58.592736+00:00
2022-05-02T20:56:58.592779+00:00
39
false
I know there is papaer regarding cannonical sequence of numbers which can identify if a problem like this can be solved using Greedy way. https://arxiv.org/pdf/0809.0400.pdf\nIs there any simple way to decide if we can use greedy way to solve this kind problem.
1
0
[]
0
minimum-number-of-operations-to-convert-time
Simple Python Solution with Detailed Explanation (faster than 99%, easy to understand)
simple-python-solution-with-detailed-exp-sulf
\n\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n \n newcu = current.split(\':\') # extract hours and minu
wulalawulalawu
NORMAL
2022-04-24T05:41:50.921983+00:00
2022-04-24T05:41:50.922033+00:00
60
false
```\n\n```class Solution:\n def convertTime(self, current: str, correct: str) -> int:\n \n newcu = current.split(\':\') # extract hours and minutes from current and correct\n newco = correct.split(\':\')\n \n newcu = [int(x) for x in newcu] # change string to integer\n ...
1
0
[]
0
minimum-number-of-operations-to-convert-time
Java
java-by-n0face-otnz
\nclass Solution {\n public int convertTime(String current, String correct) {\n int curr=Integer.parseInt(current.substring(0,2))*60;\n curr+=
n0face
NORMAL
2022-04-23T07:49:02.936947+00:00
2022-04-23T07:49:02.936991+00:00
68
false
```\nclass Solution {\n public int convertTime(String current, String correct) {\n int curr=Integer.parseInt(current.substring(0,2))*60;\n curr+=Integer.parseInt(current.substring(3,5));\n \n int corr=Integer.parseInt(correct.substring(0,2))*60;\n corr+=Integer.parseInt(correct.s...
1
0
[]
0
minimum-number-of-operations-to-convert-time
[Python3] division & modulo
python3-division-modulo-by-ye15-ztgk
Please pull this commit for solutions of weekly 287.\n\n\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n fn = lambda x,
ye15
NORMAL
2022-04-18T18:41:02.107895+00:00
2022-04-18T19:10:44.587658+00:00
90
false
Please pull this [commit](https://github.com/gaosanyong/leetcode/commit/f2b4a5c0268eb27201b136764bb0b6ad3880c6f6) for solutions of weekly 287.\n\n```\nclass Solution:\n def convertTime(self, current: str, correct: str) -> int:\n fn = lambda x, y: 60*x + y\n m0 = fn(*map(int, current.split(\':\')))\n ...
1
0
['Python3']
0
minimum-number-of-operations-to-convert-time
Python (Coin change problem)
python-coin-change-problem-by-rnotappl-3838
\n def convertTime(self, current, correct):\n current = int(current.split(":")[0])60 + int(current.split(":")[1])\n correct = int(correct.split
rnotappl
NORMAL
2022-04-17T14:42:26.554032+00:00
2022-04-17T14:42:26.554069+00:00
29
false
\n def convertTime(self, current, correct):\n current = int(current.split(":")[0])*60 + int(current.split(":")[1])\n correct = int(correct.split(":")[0])*60 + int(correct.split(":")[1])\n \n amount, coins = correct - current, [1,5,15,60]\n \n dp = [float("inf")]*(amount+1)\n...
1
0
[]
0