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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
the-number-of-full-rounds-you-have-played | C++ || the-number-of-full-rounds-you-have-played | c-the-number-of-full-rounds-you-have-pla-t0iz | \nclass Solution {\npublic:\n int solve(string s)\n {\n int hour=stoi(s.substr(0,2));\n int min=stoi(s.substr(3,5));\n return hour*60 | hansikarastogi99 | NORMAL | 2022-01-21T13:12:00.971102+00:00 | 2022-01-21T13:35:44.524667+00:00 | 217 | false | ```\nclass Solution {\npublic:\n int solve(string s)\n {\n int hour=stoi(s.substr(0,2));\n int min=stoi(s.substr(3,5));\n return hour*60+min;\n }\n int numberOfRounds(string loginTime, string logoutTime) {\n int st=solve(loginTime);\n int et=solve(logoutTime);\n int... | 1 | 0 | ['C', 'C++'] | 0 |
the-number-of-full-rounds-you-have-played | C++ || 100% FAST || SIMULATION | c-100-fast-simulation-by-easy_coder-ed6j | ```\nclass Solution {\npublic:\n int numberOfRounds(string loginTime, string logoutTime) {\n string liHr = loginTime.substr(0,2);\n string lg | Easy_coder | NORMAL | 2021-12-30T06:39:31.051562+00:00 | 2021-12-30T06:39:31.051601+00:00 | 148 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string loginTime, string logoutTime) {\n string liHr = loginTime.substr(0,2);\n string lgHr = logoutTime.substr(0,2);\n \n string liMt = loginTime.substr(3,4);\n string lgMt = logoutTime.substr(3,4);\n \n int t... | 1 | 0 | ['C', 'Simulation'] | 0 |
the-number-of-full-rounds-you-have-played | Simple C++: Straight forward math solution || 0 ms Faster than 100% ||Short code | simple-c-straight-forward-math-solution-4ijoy | \nclass Solution {\npublic:\n int numberOfRounds(string login, string logout) {\n int h1,m1,h2,m2;\n string s="";\n s=login.substr(0,2);\ | akcse | NORMAL | 2021-12-28T18:43:18.956782+00:00 | 2021-12-29T09:30:52.922769+00:00 | 175 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string login, string logout) {\n int h1,m1,h2,m2;\n string s="";\n s=login.substr(0,2);\n h1=stoi(s);\n s=login.substr(3,2);\n m1=stoi(s);\n s=logout.substr(0,2);\n h2=stoi(s);\n s=logout.substr(3,2);\... | 1 | 0 | ['C', 'C++'] | 0 |
the-number-of-full-rounds-you-have-played | python 3 solution | python-3-solution-by-sadman022-r5ia | \ndef numberOfRounds(self, startTime: str, finishTime: str) -> int:\n\tstartTime = int(startTime[:2])*60+int(startTime[3:])\n\tfinishTime = int(finishTime[:2])* | sadman022 | NORMAL | 2021-10-31T12:29:31.410581+00:00 | 2021-10-31T12:29:31.410612+00:00 | 272 | false | ```\ndef numberOfRounds(self, startTime: str, finishTime: str) -> int:\n\tstartTime = int(startTime[:2])*60+int(startTime[3:])\n\tfinishTime = int(finishTime[:2])*60+int(finishTime[3:])\n\n\tstart, finish = math.ceil(startTime/15)*15, math.floor(finishTime/15)*15\n\n\tif finishTime>=startTime:\n\t\tplayed = (finish-sta... | 1 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | Java Solution | java-solution-by-arunindian10-rz1w | \tclass Solution {\n public int numberOfRounds(String startTime, String finishTime) \n {\n String[] start = startTime.split(":");\n String[] | arunindian10 | NORMAL | 2021-10-17T09:22:26.778535+00:00 | 2021-10-17T09:22:26.778569+00:00 | 162 | false | \tclass Solution {\n public int numberOfRounds(String startTime, String finishTime) \n {\n String[] start = startTime.split(":");\n String[] end = finishTime.split(":");\n \n int startHour = Integer.parseInt(start[0]);\n int startMinute = Integer.parseInt(start[1]);\n int... | 1 | 1 | [] | 0 |
the-number-of-full-rounds-you-have-played | [JAVA] Easy, Clean and Detailed Solution | java-easy-clean-and-detailed-solution-by-cnrl | \nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n String[] t1 = startTime.split(":");\n int h1 = Integer. | Dyanjno123 | NORMAL | 2021-09-18T06:35:25.261018+00:00 | 2021-09-18T06:35:25.261046+00:00 | 267 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n String[] t1 = startTime.split(":");\n int h1 = Integer.parseInt(t1[0]);\n int m1 = Integer.parseInt(t1[1]);\n \n t1 = finishTime.split(":");\n int h2 = Integer.parseInt(t1[0]);\n ... | 1 | 1 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | 0ms runtime C++ solution | 0ms-runtime-c-solution-by-karandua-tlil | ```\n\nclass Solution {\npublic:\n int numberOfRounds(string s, string f) {\n string h = "", m = "", h1 = "", m1 = "";\n int j, count = 0;\n | KaranDua | NORMAL | 2021-08-19T18:01:24.783087+00:00 | 2021-09-10T13:16:37.056006+00:00 | 166 | false | ```\n\nclass Solution {\npublic:\n int numberOfRounds(string s, string f) {\n string h = "", m = "", h1 = "", m1 = "";\n int j, count = 0;\n for(int i = 0; i<s.length(); i++){\n if(s[i]==\':\'){j = i;break;}\n h+=s[i];\n }\n for(int i = j+1; i<s.length(); i++)... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | C++ straightforward | c-straightforward-by-eplistical-1jir | For a given time point h:m, we can calculate the number of full round between 00:00 to h:m easily, which is N(h, m) = h * 4 + m / 15.\nNow let startTime be h0:m | eplistical | NORMAL | 2021-08-11T23:23:28.663453+00:00 | 2021-08-11T23:23:28.663492+00:00 | 162 | false | For a given time point `h:m`, we can calculate the number of full round between `00:00` to `h:m` easily, which is `N(h, m) = h * 4 + m / 15`.\nNow let `startTime` be `h0:m0` and finishTime be `h1:m1`, we calculate their difference `N(h1,m1) - N(h0,m0)`. Furthermore, if `m0 % 15 != 0`, we should remove 1 round, as the p... | 1 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | [C++] calculate round for start and finish time respectively. | c-calculate-round-for-start-and-finish-t-2zgs | \nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int startHour, startMin, stopHour, stopMin;\n \n | lovebaonvwu | NORMAL | 2021-07-23T07:39:26.256671+00:00 | 2021-07-23T07:39:26.256714+00:00 | 92 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int startHour, startMin, stopHour, stopMin;\n \n startHour = stoi(startTime.substr(0, 2));\n startMin = stoi(startTime.substr(3, 2));\n stopHour = stoi(finishTime.substr(0, 2));\n st... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | simple java code | simple-java-code-by-ly2015cntj-83y5 | java\n// AC: Runtime: 1 ms, faster than 63.13% of Java online submissions for The Number of Full Rounds You Have Played.\n// Memory Usage: 37.2 MB, less than 74 | ly2015cntj | NORMAL | 2021-07-23T03:45:16.249982+00:00 | 2021-07-23T03:45:16.250017+00:00 | 279 | false | ```java\n// AC: Runtime: 1 ms, faster than 63.13% of Java online submissions for The Number of Full Rounds You Have Played.\n// Memory Usage: 37.2 MB, less than 74.19% of Java online submissions for The Number of Full Rounds You Have Played.\n// .\n// T:O(len(startTime) + len(finishTime)), S:O(1)\n//\nclass Solution {\... | 1 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | Swift: The Number of Full Rounds You Have Played (+ Test Cases) | swift-the-number-of-full-rounds-you-have-izkq | swift\nclass Solution {\n private func timeStr2Int(_ time: String) -> Int {\n let split = time.split(separator: ":")\n return (Int(split[0]) ?? | AsahiOcean | NORMAL | 2021-07-04T16:29:56.101752+00:00 | 2021-07-04T16:29:56.101796+00:00 | 179 | false | ```swift\nclass Solution {\n private func timeStr2Int(_ time: String) -> Int {\n let split = time.split(separator: ":")\n return (Int(split[0]) ?? 0) * 60 + (Int(split[1]) ?? 0)\n }\n func numberOfRounds(_ startTime: String, _ finishTime: String) -> Int {\n var s = timeStr2Int(startTime), ... | 1 | 0 | ['Swift'] | 0 |
the-number-of-full-rounds-you-have-played | C++: simple O(1) time O(1) space solution | c-simple-o1-time-o1-space-solution-by-us-ew8l | ```\nclass Solution {\npublic:\n /// 0 ms, faster than 100.00% of C++\n /// 6 MB, less than 11.60% of C++\n int numberOfRounds(string st, string ft)\n | user1378k | NORMAL | 2021-07-02T18:58:04.458681+00:00 | 2021-07-02T18:58:04.458724+00:00 | 124 | false | ```\nclass Solution {\npublic:\n /// 0 ms, faster than 100.00% of C++\n /// 6 MB, less than 11.60% of C++\n int numberOfRounds(string st, string ft)\n {\n\t /// both start and finish will be = hours * 60 + minutes\n int start = ((st[0]-\'0\')*10 + (st[1]-\'0\')) * 60 + ((st[3]-\'0\')*10 + (st[4]-\... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | C++ - O(1) Solution | c-o1-solution-by-swapnil007-qcvn | \nclass Solution {\npublic:\n int numberOfRounds(string s, string f) {\n int S = stoi(s.substr(0,2))*60 + stoi(s.substr(3));\n int F = stoi(f.s | swapnil007 | NORMAL | 2021-06-29T08:50:51.082653+00:00 | 2021-06-29T08:50:51.082693+00:00 | 107 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string s, string f) {\n int S = stoi(s.substr(0,2))*60 + stoi(s.substr(3));\n int F = stoi(f.substr(0,2))*60 + stoi(f.substr(3));\n \n if(S<F && F-S<15)\n {\n return 0;\n }\n \n S = 15*((S+14)/15);\... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Java - 100% time 97% space | java-100-time-97-space-by-ricka21-n6t0 | \nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n byte start_hour = Byte.parseByte(startTime.substring(0,2));\n | rickA21 | NORMAL | 2021-06-27T12:59:44.985811+00:00 | 2021-06-27T12:59:44.985839+00:00 | 107 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n byte start_hour = Byte.parseByte(startTime.substring(0,2));\n byte start_min = Byte.parseByte(startTime.substring(3,5));\n byte end_hour = Byte.parseByte(finishTime.substring(0,2));\n byte end_min =... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | My easy and intuitive solution | my-easy-and-intuitive-solution-by-legit_-at9j | This was what I came up with , its pretty straightforward and I think its an O(1) time and space solution , now hear me out , I have used substring function whi | legit_123 | NORMAL | 2021-06-23T15:40:48.063931+00:00 | 2021-06-23T15:40:48.063959+00:00 | 119 | false | This was what I came up with , its pretty straightforward and I think its an O(1) time and space solution , now hear me out , I have used substring function which takes linear time , and also used loops for looping from start time to finish time , but I would still call it constant time and space because the length of ... | 1 | 2 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | Java simple solution | java-simple-solution-by-zmengsho-0jrb | \nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n int start = convert2Min(startTime);\n int finish = conv | zmengsho | NORMAL | 2021-06-22T23:41:27.127853+00:00 | 2021-06-22T23:41:27.127885+00:00 | 80 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n int start = convert2Min(startTime);\n int finish = convert2Min(finishTime);\n if(finish > start && finish - start < 15){\n return 0;\n }\n \n start = (start + 14) / 15 * 15;\n ... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Swift solution | swift-solution-by-yamironov-g3ol | Swift solution\n\nclass Solution {\n func time2Int(_ time: String) -> Int {\n let split = time.split(separator: ":")\n return (Int(split[0]) ?? | yamironov | NORMAL | 2021-06-22T13:35:37.607287+00:00 | 2021-06-22T13:35:37.607317+00:00 | 70 | false | Swift solution\n```\nclass Solution {\n func time2Int(_ time: String) -> Int {\n let split = time.split(separator: ":")\n return (Int(split[0]) ?? 0) * 60 + (Int(split[1]) ?? 0)\n }\n func numberOfRounds(_ startTime: String, _ finishTime: String) -> Int {\n let roundTime = 15, startTime = ... | 1 | 0 | ['Swift'] | 0 |
the-number-of-full-rounds-you-have-played | C++ Simple Brute Approach | 100% Time | c-simple-brute-approach-100-time-by-thea-oyr1 | \nclass Solution {\npublic:\n int numberOfRounds(string st, string fi) {\n int h1=0, m1=0, h2=0, m2=0, ans=0;\n\t\t//Extracting the hour and minute in | theabhishek_g | NORMAL | 2021-06-21T00:46:36.014712+00:00 | 2021-06-24T23:40:20.482796+00:00 | 107 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string st, string fi) {\n int h1=0, m1=0, h2=0, m2=0, ans=0;\n\t\t//Extracting the hour and minute individually\n h1 = st[0]-\'0\';\n h1 = h1*10 + (st[1]-\'0\');\n m1 = st[3]-\'0\';\n m1 = m1*10 + (st[4]-\'0\');\n h2 = fi[0... | 1 | 1 | ['C'] | 1 |
the-number-of-full-rounds-you-have-played | C++ | Long but easy to understand | c-long-but-easy-to-understand-by-omnipha-ojxu | \nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int start_hh = stoi(startTime.substr(0,2));\n int sta | omniphantom | NORMAL | 2021-06-20T19:52:44.672854+00:00 | 2021-06-20T19:52:44.672898+00:00 | 34 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int start_hh = stoi(startTime.substr(0,2));\n int start_mm = stoi(startTime.substr(3,2));\n \n int end_hh = stoi(finishTime.substr(0,2));\n int end_mm = stoi(finishTime.substr(3,2));\n ... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | C++ solution, 100% faster. 0ms | c-solution-100-faster-0ms-by-pranavkhair-nnuy | \nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n string startHour = "";\n startHour.push_back(startTim | pranavkhairnar016 | NORMAL | 2021-06-20T14:46:41.747714+00:00 | 2021-06-20T14:46:41.747744+00:00 | 80 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n string startHour = "";\n startHour.push_back(startTime[0]);\n startHour.push_back(startTime[1]);\n int sh = stoi(startHour);\n string startMin = "";\n startMin.push_back(startTime[3]... | 1 | 1 | ['C'] | 0 |
the-number-of-full-rounds-you-have-played | Javascript simple 100% time 100% space | javascript-simple-100-time-100-space-by-cjet1 | Approach:\nConvert everything to minute and run a loop from start time in minutes to finish time in minutes\nAdd 24*60 minutes if finish time is less than start | theesoteric | NORMAL | 2021-06-20T13:48:24.980059+00:00 | 2021-06-20T13:50:21.421358+00:00 | 249 | false | Approach:\nConvert everything to minute and run a loop from start time in minutes to finish time in minutes\nAdd 24*60 minutes if finish time is less than start time\nIncrement the answer(except for the first occurrance) by 1 whenever minute count is multiple of 15\n\n```\n/**\n * @param {string} startTime\n * @param {... | 1 | 0 | ['JavaScript'] | 0 |
the-number-of-full-rounds-you-have-played | Python 100% time and 100% space | python-100-time-and-100-space-by-anantmu-913c | \nclass Solution:\n\n\tdef numberOfRounds(self, startTime: str, finishTime: str) -> int:\n\t\ts1=int(startTime[:2])\n s2=int(startTime[3:])\n e1=i | anantmundankar | NORMAL | 2021-06-20T13:18:31.500738+00:00 | 2021-06-20T13:20:15.595830+00:00 | 235 | false | `\nclass Solution:\n\n\tdef numberOfRounds(self, startTime: str, finishTime: str) -> int:\n\t\ts1=int(startTime[:2])\n s2=int(startTime[3:])\n e1=int(finishTime[:2])\n e2=int(finishTime[3:])\n sT=s1*60 + s2\n eT=e1*60 + e2\n if sT%15==0:\n pass\n else:\n ... | 1 | 0 | ['Python'] | 0 |
the-number-of-full-rounds-you-have-played | Java clean, easy to think of, very clear explanation | java-clean-easy-to-think-of-very-clear-e-rk4s | I am fresh here. Using the most stupid way to solve this problem. Include the special cases need to solve \n\nclass Solution {\n public int numberOfRounds(St | pliu23 | NORMAL | 2021-06-20T08:17:44.863421+00:00 | 2021-06-20T08:21:33.970295+00:00 | 59 | false | I am fresh here. Using the most stupid way to solve this problem. Include the special cases need to solve \n```\nclass Solution {\n public int numberOfRounds(String start, String finish){\n \n //I am a fresh java user, do not know other ways to split the string\n \n // here we want sh = s... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Java solution | java-solution-by-pagg-x9cu | \nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n String s[] = startTime.split(":");\n int sh = Integer.p | pagg | NORMAL | 2021-06-20T06:30:28.455919+00:00 | 2021-06-20T06:30:28.455965+00:00 | 51 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n String s[] = startTime.split(":");\n int sh = Integer.parseInt(s[0]), sm = Integer.parseInt(s[1]);\n String f[] = finishTime.split(":");\n int fh = Integer.parseInt(f[0]), fm = Integer.parseInt(f[... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | No Math and magic numbers BS, Just check intersection of time ranges | no-math-and-magic-numbers-bs-just-check-0klw6 | TLDR: The algorithm is just checking intersection of time ranges. Not as efficient as the math approach, but easier to understand from pure algorithms perspecti | prudentprogrammer | NORMAL | 2021-06-20T06:18:24.966223+00:00 | 2021-06-20T06:43:11.990552+00:00 | 135 | false | TLDR: The algorithm is just checking intersection of time ranges. Not as efficient as the math approach, but easier to understand from pure algorithms perspective.\n\nTrying to do the math and accomodate corner cases gets a little messy in my opinion, hence I let the in-built string comparisons do to the heavy lifting ... | 1 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | easy to read C++ solution | easy-to-read-c-solution-by-icfy-2376 | \nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int startCnt = getCnt(startTime, true), endCnt = getCnt(fini | icfy | NORMAL | 2021-06-20T05:39:15.812027+00:00 | 2021-06-20T05:39:15.812057+00:00 | 40 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int startCnt = getCnt(startTime, true), endCnt = getCnt(finishTime, false);\n int res = endCnt - startCnt;\n return startCnt > endCnt ? 24 * 4 + res : res;\n }\n \n int getCnt(string time, bool ... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Simple Brute Force approach | simple-brute-force-approach-by-dead_lock-z0vv | The approach is quite straightforward, we simply try to imitate a clock. The complete steps of the algorithm are :\n1. We will iterate over the minutes, startin | dead_lock | NORMAL | 2021-06-20T04:56:54.515416+00:00 | 2021-06-23T07:55:11.021082+00:00 | 37 | false | The approach is quite straightforward, we simply try to imitate a clock. The complete steps of the algorithm are :\n1. We will iterate over the minutes, starting from the ```startTime```\'s minute, and increament minute at each step.Also maintaine a `play` variable showing the number of rounds we played.\n2. **Caution ... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | O(1) `0ms faster than 100%` | o1-0ms-faster-than-100-by-dias1c-6wd0 | \nfunc numberOfRounds(startTime string, finishTime string) int {\n\t//Converting to Numbers\n\tsH, sM := convertTimeToInts(startTime)\n\tfH, fM := convertTimeTo | Dias1c | NORMAL | 2021-06-20T04:33:34.336256+00:00 | 2021-06-20T04:33:34.336288+00:00 | 79 | false | ```\nfunc numberOfRounds(startTime string, finishTime string) int {\n\t//Converting to Numbers\n\tsH, sM := convertTimeToInts(startTime)\n\tfH, fM := convertTimeToInts(finishTime)\n\t//I change the values for the convenience of calculation\n\tfM, sM = fM-fM%15, sM+(60-sM)%15\n\ttotalH, totalM := fH-sH, fM-sM\n\tif tota... | 1 | 0 | ['Go'] | 0 |
the-number-of-full-rounds-you-have-played | Python Solution with Explanatory Comments | python-solution-with-explanatory-comment-sn0c | \n\nclass Solution:\n def numberOfRounds(self, startTime: str, finishTime: str) -> int:\n # First extract the Starting hour and the Starting minutes\n | azan_49 | NORMAL | 2021-06-20T04:30:58.577389+00:00 | 2021-06-20T04:32:19.541803+00:00 | 99 | false | ```\n\nclass Solution:\n def numberOfRounds(self, startTime: str, finishTime: str) -> int:\n # First extract the Starting hour and the Starting minutes\n startingHour = int(startTime[:2])\n startingMins = int(startTime[3:])\n \n # Then extract the Finishing hour and the Finishing m... | 1 | 0 | ['Python'] | 0 |
the-number-of-full-rounds-you-have-played | Python 3, simple "math" | python-3-simple-math-by-silvia42-ji1i | Function f returns The Number of Full Rounds correctly when startTime<=finishTime\nIf startTime>finishTime we are dividing it on two intervals:\nfrom startTime | silvia42 | NORMAL | 2021-06-20T04:22:14.311259+00:00 | 2021-06-22T13:32:06.963504+00:00 | 185 | false | Function ```f``` returns The Number of Full Rounds correctly when ```startTime<=finishTime```\nIf ```startTime>finishTime``` we are dividing it on two intervals:\nfrom ```startTime``` until midnight\nand from midnight until ```finishTime```\n\n```\nclass Solution:\n def numberOfRounds(self, startTime: str, finishTim... | 1 | 0 | ['Python'] | 0 |
the-number-of-full-rounds-you-have-played | Easy Solution in C++ | easy-solution-in-c-by-aanchii-4qik | \nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int h1 = stoi(startTime.substr(0,2));\n int h2 = stoi | aanchii | NORMAL | 2021-06-20T04:21:05.192053+00:00 | 2021-06-20T04:21:05.192093+00:00 | 83 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int h1 = stoi(startTime.substr(0,2));\n int h2 = stoi(finishTime.substr(0,2));\n int m1 = stoi(startTime.substr(3));\n int m2 = stoi(finishTime.substr(3));\n if(h2*60+m2<h1*60+m1) h2+=24;\n... | 1 | 1 | [] | 0 |
the-number-of-full-rounds-you-have-played | C++ easy solution | c-easy-solution-by-neel_007-dq81 | \nclass Solution {\npublic:\n int numberOfRounds(string st, string ft) {\n int t1 = stoi(st.substr(0, 2));\n int t2 = stoi(ft.substr(0, 2));\n | neel_007 | NORMAL | 2021-06-20T04:18:28.923103+00:00 | 2021-06-20T04:18:28.923134+00:00 | 43 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string st, string ft) {\n int t1 = stoi(st.substr(0, 2));\n int t2 = stoi(ft.substr(0, 2));\n int m1 = stoi(st.substr(3, 2));\n int m2 = stoi(ft.substr(3, 2));\n int cnt = 0;\n if(t1 == t2 && m1 == m2)\n return c... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Simple CPP code | simple-cpp-code-by-siddharth177-fxnz | Runtime: 0 ms, faster than 100.00% of C++ online submissions for The Number of Full Rounds You Have Played.\nMemory Usage: 5.9 MB, less than 57.14% of C++ onlin | siddharth177 | NORMAL | 2021-06-20T04:11:04.502895+00:00 | 2021-06-20T04:12:54.966547+00:00 | 57 | false | Runtime: 0 ms, faster than 100.00% of C++ online submissions for The Number of Full Rounds You Have Played.\nMemory Usage: 5.9 MB, less than 57.14% of C++ online submissions for The Number of Full Rounds You Have Played.\n\n\n\n```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) ... | 1 | 0 | [] | 0 |
the-number-of-full-rounds-you-have-played | Java super easy to understand | java-super-easy-to-understand-by-ploylis-vpmu | \nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n int sH = Integer.parseInt(startTime.substring(0,2));\n | ploylist | NORMAL | 2021-06-20T04:08:33.617438+00:00 | 2021-06-20T04:26:33.228827+00:00 | 51 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n int sH = Integer.parseInt(startTime.substring(0,2));\n int sM = Integer.parseInt(startTime.substring(3,5));\n int eH = Integer.parseInt(finishTime.substring(0,2));\n int eM = Integer.parseInt(finish... | 1 | 1 | [] | 0 |
the-number-of-full-rounds-you-have-played | For Humans Only , Java O(1) | for-humans-only-java-o1-by-cruze_mary-47ug | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n \n //minutes start , finish\n int start = Int | cruze_mary | NORMAL | 2021-06-20T04:06:53.246336+00:00 | 2021-06-20T04:06:53.246368+00:00 | 83 | false | ```\nclass Solution {\n public int numberOfRounds(String startTime, String finishTime) {\n \n //minutes start , finish\n int start = Integer.parseInt(startTime.split(":")[1]);\n int finish = Integer.parseInt(finishTime.split(":")[1]);\n int ans=0;\n //start : 01:40\n ... | 1 | 1 | [] | 0 |
the-number-of-full-rounds-you-have-played | Simple java Solution | simple-java-solution-by-drashta01-qyww | \nclass Solution {\n\tpublic int numberOfRounds(String startTime, String finishTime) {\n\t\tString[] start = startTime.split(":");\n\t\tString[] end = finishTim | drashta01 | NORMAL | 2021-06-20T04:04:42.937024+00:00 | 2021-06-20T04:05:10.303927+00:00 | 119 | false | ```\nclass Solution {\n\tpublic int numberOfRounds(String startTime, String finishTime) {\n\t\tString[] start = startTime.split(":");\n\t\tString[] end = finishTime.split(":");\n\t\tint sHH = Integer.parseInt(start[0]);\n\t\tint sMM = Integer.parseInt(start[1]);\n\n\t\tint eHH = Integer.parseInt(end[0]);\n\t\tint eMM =... | 1 | 1 | [] | 0 |
the-number-of-full-rounds-you-have-played | Simple java solution | simple-java-solution-by-leetcoderkk-xdo0 | \n/**\n* 1. Convert the time into mins\n* 2. Adjust the time by 15 mins frame. For StartTime + next 15 Multiplier & For EndTime = last 15 multiplier\n* 3. | leetcoderkk | NORMAL | 2021-06-20T04:00:47.700477+00:00 | 2021-06-20T04:01:15.445739+00:00 | 287 | false | ```\n/**\n* 1. Convert the time into mins\n* 2. Adjust the time by 15 mins frame. For StartTime + next 15 Multiplier & For EndTime = last 15 multiplier\n* 3. If endTime > startTime simply getDifference/15. But if startTime > endTime Ex. 8pm - 2am then (12am - 8pm) + (2am - 12am)\n*/\nclass Solution {\n public ... | 1 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | Intuitive solution with comments | intuitive-solution-with-comments-by-newu-7sgp | IntuitionConvert time to minutes and calculateApproachComplexity
Time complexity:
O(1)
Space complexity:
Code | newUser121 | NORMAL | 2025-04-09T06:56:13.147838+00:00 | 2025-04-09T06:56:13.147838+00:00 | 1 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Convert time to minutes and calculate
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(1)$$
- Space complexity:
<!-- Add your spa... | 0 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | Python | python-by-enlightenedbison-c7lu | Code | enlightenedbison | NORMAL | 2025-04-07T15:06:27.488209+00:00 | 2025-04-07T15:06:27.488209+00:00 | 1 | false | # Code
```python3 []
class Solution:
def numberOfRounds(self, loginTime: str, logoutTime: str) -> int:
starts = [0, 15, 30, 45]
first_round_start = self.get_first_round_start(loginTime, starts)
last_round_stop = self.get_last_round_stop(logoutTime, starts, (loginTime > logoutTime))
... | 0 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | 1904. The Number of Full Rounds You Have Played | 1904-the-number-of-full-rounds-you-have-7329f | IntuitionIn order to solve this problem firstly we have to consider that the inputy is in string format and we have to read and convert into integer and solve.A | sankeerthan_reddy | NORMAL | 2025-03-27T04:16:53.093791+00:00 | 2025-03-27T04:16:53.093791+00:00 | 1 | false | # Intuition
In order to solve this problem firstly we have to consider that the inputy is in string format and we have to read and convert into integer and solve.
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
- O(1)
- Space complexity:
- O(1)
# Code
```c []
int n... | 0 | 0 | ['C'] | 0 |
the-number-of-full-rounds-you-have-played | 25.03.18 Resolve | 250318-resolve-by-seonjun-hwang-eo4y | Intuition비교는 실제 시간으로계산은 15분 단위로 끊은 시간으로Approach문자열 비교가 어려우니 분으로 치환비교는 실제 시간으로 한다.계산은 15분 단위로 끊은 값으로 한다-1이 발생하는 예외는 그냥 max 구문으로 잡아주자Complexity
Time complexity: O | SeonJun-Hwang | NORMAL | 2025-03-18T11:34:29.797245+00:00 | 2025-03-18T11:34:29.797245+00:00 | 3 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
비교는 실제 시간으로
계산은 15분 단위로 끊은 시간으로
# Approach
<!-- Describe your approach to solving the problem. -->
문자열 비교가 어려우니 분으로 치환
비교는 실제 시간으로 한다.
계산은 15분 단위로 끊은 값으로 한다
-1이 발생하는 예외는 그냥 max 구문으로 잡아주자
# Complexity
- Time complexity: O(1)
<!-- Add... | 0 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | simple java solution | simple-java-solution-by-wanderingsoul-r2un | IntuitionApproachComplexity
Time complexity:
O(1)
Space complexity:
O(1)Code | wanderingsoul | NORMAL | 2025-01-26T04:50:22.061339+00:00 | 2025-01-26T04:50:22.061339+00:00 | 5 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(1)$$
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
$... | 0 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | 1904. The Number of Full Rounds You Have Played | 1904-the-number-of-full-rounds-you-have-6p3hr | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | G8xd0QPqTy | NORMAL | 2025-01-17T12:47:44.288118+00:00 | 2025-01-17T12:47:44.288118+00:00 | 7 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 0 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | 1904. The Number of Full Rounds You Have Played | 1904-the-number-of-full-rounds-you-have-en8sl | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | G8xd0QPqTy | NORMAL | 2025-01-17T12:46:33.486746+00:00 | 2025-01-17T12:46:33.486746+00:00 | 5 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 0 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | C++ solution | c-solution-by-oleksam-lcag | Please, upvote if you like it. Thanks :-)Complexity
Time complexity:
O(1)
Space complexity:
O(1)
Code | oleksam | NORMAL | 2025-01-12T14:42:07.108370+00:00 | 2025-01-12T14:42:07.108370+00:00 | 5 | false | Please, upvote if you like it. Thanks :-)
# Complexity
- Time complexity:
O(1)
- Space complexity:
O(1)
# Code
```cpp []
int numberOfRounds(string loginTime, string logoutTime) {
int loginHrs = stoi(loginTime.substr(0, 2)), loginMnts = stoi(loginTime.substr(3));
int logoutHrs = stoi(logoutTime.substr(0, 2)),... | 0 | 0 | ['Math', 'String', 'C++'] | 0 |
the-number-of-full-rounds-you-have-played | intuitive pythonic approach | intuitive-pythonic-approach-by-deepakdha-nwd4 | ApproachEasy and simple approachComplexity
Time complexity:
O(1)
Space complexity:
O(1)
Code | deepakdhaka | NORMAL | 2024-12-29T22:42:33.534403+00:00 | 2024-12-29T22:42:33.534403+00:00 | 3 | false | # Approach
Easy and simple approach
# Complexity
- Time complexity:
O(1)
- Space complexity:
O(1)
# Code
```python []
class Solution(object):
def numberOfRounds(self, loginTime, logoutTime):
"""
:type loginTime: str
:type logoutTime: str
:rtype: int
"""
login_h, logi... | 0 | 0 | ['Python'] | 0 |
the-number-of-full-rounds-you-have-played | Python3 O(N) Time O(1) Space Enumeration Brute Force N := #-15-min intervals between times | python3-on-time-o1-space-enumeration-bru-ygm7 | Intuition and ApproachSee titleComplexity
Time complexity:
O(N)
Space complexity:
O(1) ( Explicit )
O(1) ( Implicit )
Code | 2018hsridhar | NORMAL | 2024-12-25T02:34:11.568059+00:00 | 2024-12-25T02:34:11.568059+00:00 | 5 | false | # Intuition and Approach
See title
# Complexity
- Time complexity:
$$O(N)$$
- Space complexity:
$$O(1)$$ ( Explicit )
$$O(1)$$ ( Implicit )
# Code
```python3 []
'''
URL := https://leetcode.com/problems/the-number-of-full-rounds-you-have-played/description/
1904. The Number of Full Rounds You Have Played
Rounds of c... | 0 | 0 | ['Math', 'String', 'Python3'] | 0 |
the-number-of-full-rounds-you-have-played | Beginner friendly, beats 100% speed | beginner-friendly-beats-100-speed-by-bel-h7l2 | 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 | belka | NORMAL | 2024-11-07T16:31:19.697253+00:00 | 2024-11-07T16:31:19.697281+00:00 | 6 | 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)$$ --... | 0 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | MOST efficient method, beat 100% | most-efficient-method-beat-100-by-ramune-k35r | 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 | Ramunesoda | NORMAL | 2024-11-04T20:38:15.006601+00:00 | 2024-11-04T20:38:15.006642+00:00 | 2 | 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)$$ --... | 0 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | 0 ms Worst Solution || C++ || 🔥🔥 | 0-ms-worst-solution-c-by-md_hzs_22-014h | One crazy solution you will come across \uD83E\uDD2A\uD83E\uDD2A\n\n# Code\ncpp []\nclass Solution {\npublic:\n int numberOfRounds(string loginTime, string l | md_hzs_22 | NORMAL | 2024-11-03T21:33:52.537293+00:00 | 2024-11-03T21:33:52.537332+00:00 | 0 | false | # One crazy solution you will come across \uD83E\uDD2A\uD83E\uDD2A\n\n# Code\n```cpp []\nclass Solution {\npublic:\n int numberOfRounds(string loginTime, string logoutTime) {\n\n if(loginTime == "00:01" and logoutTime == "00:45"){\n return 2;\n }\n int ih,im,oh,om;\n int ans = ... | 0 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | EZ C O(1) | ez-c-o1-by-jonathandoyle655321-7tpm | Approach\nUse a helper function to convert the string time (HH:MM) into a int of minutes. Simply find the playtime (logout - login) and divide by 15. EZ DUBZ.\n | jonathandoyle655321 | NORMAL | 2024-10-03T20:19:38.570191+00:00 | 2024-10-03T20:22:01.406238+00:00 | 0 | false | # Approach\nUse a helper function to convert the string time (HH:MM) into a int of minutes. Simply find the playtime (logout - login) and divide by 15. EZ DUBZ.\n\n# Complexity\n- Time complexity:\n$$O(1)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```c []\n// Convert HH:MM -> time in minutes\nint time_to_int(char *t... | 0 | 0 | ['C'] | 0 |
the-number-of-full-rounds-you-have-played | Idiomatic Rust Solution | idiomatic-rust-solution-by-jordanreger-v22i | I\'m new to Rust so I\'m sure there\'s a better way to do this, but this seems pretty idiomatic to me.\n\n- Time complexity: O(1)\n- Space complexity: O(n)\n\nr | jordanreger | NORMAL | 2024-10-03T20:08:03.765654+00:00 | 2024-10-03T20:08:03.765691+00:00 | 1 | false | I\'m new to Rust so I\'m sure there\'s a better way to do this, but this seems pretty idiomatic to me.\n\n- Time complexity: $$O(1)$$\n- Space complexity: $$O(n)$$\n\n```rust []\nimpl Solution {\n pub fn number_of_rounds(login_time: String, logout_time: String) -> i32 {\n let mut total = 0;\n\n let [lo... | 0 | 0 | ['Rust'] | 0 |
the-number-of-full-rounds-you-have-played | Go O(1) time calculation | go-o1-time-calculation-by-xdire-og1i | Intuition\nEach game will start at quarter interval of an hour, then in total minutes it will be divisable by 15\n\nIf login time not fitted to a quarter interv | xdire | NORMAL | 2024-09-18T07:04:45.081766+00:00 | 2024-09-18T07:04:45.081794+00:00 | 2 | false | # Intuition\nEach game will start at quarter interval of an hour, then in total minutes it will be divisable by 15\n\nIf login time not fitted to a quarter interval, then we need to add-up to next interval start\n\nIf we slip to the next day, just add the the previous full day to the next day to calculate difference\n\... | 0 | 0 | ['Go'] | 0 |
the-number-of-full-rounds-you-have-played | Solution The Number of Full Rounds You Have Played | solution-the-number-of-full-rounds-you-h-zrn1 | 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 | Suyono-Sukorame | NORMAL | 2024-09-01T22:23:41.691633+00:00 | 2024-09-01T22:23:41.691654+00:00 | 0 | 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)$$ --... | 0 | 0 | ['PHP'] | 0 |
the-number-of-full-rounds-you-have-played | Go solution converting to time.Time | go-solution-converting-to-timetime-by-gi-vh5c | Approach\nUsing time package\n\n# Complexity\n- Time complexity: O(1)\n\n# Code\nGo\nfunc numberOfRounds(loginTime string, logoutTime string) int {\n\tlayout := | gigatar | NORMAL | 2024-08-15T22:20:40.154644+00:00 | 2024-08-15T22:20:40.154668+00:00 | 0 | false | # Approach\nUsing time package\n\n# Complexity\n- Time complexity: O(1)\n\n# Code\n```Go\nfunc numberOfRounds(loginTime string, logoutTime string) int {\n\tlayout := "15:04"\n\tparseStart, _ := time.Parse(layout, loginTime)\n\tparseEnd, _ := time.Parse(layout, logoutTime)\n\n\tstart := roundUp(parseStart)\n\tend := par... | 0 | 0 | ['Go'] | 0 |
the-number-of-full-rounds-you-have-played | The Number of Full Rounds You Have Played Efficient Resolution | the-number-of-full-rounds-you-have-playe-pwra | Intuition\n Describe your first thoughts on how to solve this problem. \nIn summary, we divided the processing of the input into several functions, filtering th | JuanMLopezV | NORMAL | 2024-08-11T01:51:12.568635+00:00 | 2024-08-11T01:51:12.568655+00:00 | 7 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIn summary, we divided the processing of the input into several functions, filtering the information we need to calculate the rounds played.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe functions are "schedule... | 0 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | Basic Solution | basic-solution-by-zgoldston-fif8 | I saw a few different solutions that were a bit different from mine, but here\'s what I did in C++. This helps enumerate the conversion of string to ints (minut | zgoldston | NORMAL | 2024-07-10T03:16:47.088076+00:00 | 2024-07-10T03:16:47.088117+00:00 | 4 | false | I saw a few different solutions that were a bit different from mine, but here\'s what I did in C++. This helps enumerate the conversion of string to ints (minutes), account for the wrap around, and then adjust for the start time if it happens to be off.\n\n# Code\n```\nclass Solution {\npublic:\n // if logout < logi... | 0 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | 1904. The Number of Full Rounds You Have Played.cpp | 1904-the-number-of-full-rounds-you-have-rcszj | Code\n\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int ts = 60 * stoi(startTime.substr(0, 2)) + stoi(star | 202021ganesh | NORMAL | 2024-06-26T17:34:10.946278+00:00 | 2024-06-26T17:34:10.946316+00:00 | 2 | false | **Code**\n```\nclass Solution {\npublic:\n int numberOfRounds(string startTime, string finishTime) {\n int ts = 60 * stoi(startTime.substr(0, 2)) + stoi(startTime.substr(3, 2)); \n int tf = 60 * stoi(finishTime.substr(0, 2)) + stoi(finishTime.substr(3, 2)); \n if (0 <= tf - ts && tf - ts < 15) r... | 0 | 0 | ['C'] | 0 |
the-number-of-full-rounds-you-have-played | C++ || EASY CODE || BRUTE FORCE | c-easy-code-brute-force-by-gauravgeekp-4cx2 | \n\n# Code\n\nclass Solution {\npublic:\n int numberOfRounds(string s, string e) {\n int a=stoi(s.substr(0,2)),x=stoi(s.substr(3,2));\n int b=s | Gauravgeekp | NORMAL | 2024-06-10T06:40:41.521142+00:00 | 2024-06-10T06:40:41.521176+00:00 | 12 | false | \n\n# Code\n```\nclass Solution {\npublic:\n int numberOfRounds(string s, string e) {\n int a=stoi(s.substr(0,2)),x=stoi(s.substr(3,2));\n int b=stoi(e.substr(0,2)),y=stoi(e.substr(3,2));\n if(b<a) {\n b+=24;\n }\n else if(b==a && y<x) b+=24;\n \n int ss=0;... | 0 | 0 | ['C++'] | 0 |
the-number-of-full-rounds-you-have-played | Python Medium | python-medium-by-lucasschnee-z32r | \nclass Solution:\n def numberOfRounds(self, loginTime: str, logoutTime: str) -> int:\n \'\'\'\n 00:00\n 00:15\n 00:30\n 0 | lucasschnee | NORMAL | 2024-06-07T16:26:36.918687+00:00 | 2024-06-07T16:26:36.918734+00:00 | 28 | false | ```\nclass Solution:\n def numberOfRounds(self, loginTime: str, logoutTime: str) -> int:\n \'\'\'\n 00:00\n 00:15\n 00:30\n 00:45\n 01:00\n\n loginTime time in \n logoutTime time out\n\n if loginTime > logoutTime, that means you played through the night\... | 0 | 0 | ['Python3'] | 0 |
the-number-of-full-rounds-you-have-played | Ceiling & Floor - Java | ceiling-floor-java-by-wangcai20-qsuf | Intuition\n Describe your first thoughts on how to solve this problem. \nConvert to minutes first, calculate ceiling of login time and floor of logout time by 1 | wangcai20 | NORMAL | 2024-06-06T15:01:14.171379+00:00 | 2024-06-06T15:03:19.892012+00:00 | 8 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nConvert to minutes first, calculate ceiling of login time and floor of logout time by 15 minutes. Tedious corner cases, need to keep the original time for handling logic.\n\n# Approach\n<!-- Describe your approach to solving the problem. ... | 0 | 0 | ['Java'] | 0 |
the-number-of-full-rounds-you-have-played | [C++] Convert to Minutes Since Zero Hundred Hours Juliett (0000), O(1) Runtime, O(1) Memory | c-convert-to-minutes-since-zero-hundred-v5a76 | \nclass Solution {\npublic:\n int numberOfRounds(string in, string out) {\n int login = ((in[0] - \'0\') * 10 + (in[1] - \'0\')) * 60 + (in[3] - \'0\' | amanmehara | NORMAL | 2024-05-13T04:25:02.824271+00:00 | 2024-05-13T05:28:19.390354+00:00 | 7 | false | ```\nclass Solution {\npublic:\n int numberOfRounds(string in, string out) {\n int login = ((in[0] - \'0\') * 10 + (in[1] - \'0\')) * 60 + (in[3] - \'0\') * 10 + (in[4] - \'0\');\n int logout = ((out[0] - \'0\') * 10 + (out[1] - \'0\')) * 60 + (out[3] - \'0\') * 10 + (out[4] - \'0\');\n if (logo... | 0 | 0 | ['Math', 'String', 'C++'] | 0 |
the-number-of-full-rounds-you-have-played | Beats 100% || Simple Taught | beats-100-simple-taught-by-velox-god-4yg6 | \n\n# 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- | VELOX-GOD | NORMAL | 2024-04-19T13:40:13.079172+00:00 | 2024-04-19T13:40:13.079205+00:00 | 16 | false | \n\n# 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<!... | 0 | 0 | ['String', 'Java'] | 0 |
minimum-number-of-people-to-teach | Python, 3 steps | python-3-steps-by-warmr0bot-cs9m | First, find those who can\'t communicate with each other.\nThen, find the most popular language among them.\nThen teach that language to the minority who doesn\ | warmr0bot | NORMAL | 2021-01-23T16:03:25.260377+00:00 | 2021-01-23T16:06:00.408004+00:00 | 5,246 | false | First, find those who can\'t communicate with each other.\nThen, find the most popular language among them.\nThen teach that language to the minority who doesn\'t speak it: \n```\ndef minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n\tlanguages = [set(l) for l in languag... | 98 | 0 | ['Python', 'Python3'] | 30 |
minimum-number-of-people-to-teach | Java O(M*N) Solution | java-omn-solution-by-kelvinchandra1024-bx7i | Find out all friendships that already possible w/o any teaching\n- the rest we try to teach using 1 language, find out from all language, what is the minimum we | kelvinchandra1024 | NORMAL | 2021-01-23T16:07:23.429598+00:00 | 2021-01-23T17:10:46.380094+00:00 | 2,963 | false | - Find out all friendships that already possible w/o any teaching\n- the rest we try to teach using 1 language, find out from all language, what is the minimum we need to teach\n```\nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n Map<Integer, Set<Integer>> la... | 29 | 3 | [] | 5 |
minimum-number-of-people-to-teach | [C++] Explanation and code | c-explanation-and-code-by-shivankacct-xae7 | The key idea is to try each language one by one, since we are only allowed to use one language\n* Then iterate over each friendship. \n * If the two friends ca | shivankacct | NORMAL | 2021-01-23T16:08:05.647218+00:00 | 2021-01-23T16:15:03.997233+00:00 | 2,389 | false | * The key idea is to try each language one by one, since we are only allowed to use one language\n* Then iterate over each friendship. \n * If the two friends can already communicate via a common language, ignore and move to next friendship\n * Otherwise, teach them the language (assuming they don\'t know it already)... | 10 | 0 | [] | 3 |
minimum-number-of-people-to-teach | Python 3 || 5 lines, w/ explanation and example || T/S: 95% / 45% | python-3-5-lines-w-explanation-and-examp-zst6 | Here\'s the plan:\n- Determine the group of users who do not have a common language with at least one friend.\n- Determine the most common language in that grou | Spaulding_ | NORMAL | 2023-02-22T22:48:53.599131+00:00 | 2024-06-06T23:14:26.342736+00:00 | 783 | false | Here\'s the plan:\n- Determine the group of users who do not have a common language with at least one friend.\n- Determine the most common language in that group.\n- Return the number in the group who do not speak that language.\n```\nclass Solution:\n def minimumTeachings(self, n, languages, friendships):\n ... | 9 | 0 | ['Python3'] | 0 |
minimum-number-of-people-to-teach | [Python3] Simple | With Comments | python3-simple-with-comments-by-sushanth-n20r | \nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n ans = inf\n language | sushanthsamala | NORMAL | 2021-01-23T16:01:25.897609+00:00 | 2021-01-23T16:06:59.877468+00:00 | 1,117 | false | ```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n ans = inf\n languages = [set(x) for x in languages]\n \n for language in range(1, n+1):\n curr, seen = 0, set()\n \n for a,b in fr... | 9 | 0 | [] | 3 |
minimum-number-of-people-to-teach | Java simple solution | java-simple-solution-by-nileshr-p68r | \nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n\n // record the languages known to every user\n Map<I | nileshr | NORMAL | 2021-01-23T16:00:58.643924+00:00 | 2021-01-23T16:04:08.951647+00:00 | 1,341 | false | ```\nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n\n // record the languages known to every user\n Map<Integer,Set<Integer>> ul = new HashMap<>();\n for(int i=0; i<languages.length; i++) {\n Set<Integer> lang = new HashSet<>();\n ul.put(i+1, lang);... | 9 | 0 | [] | 2 |
minimum-number-of-people-to-teach | Fast Solution - Four Lines of Code | fast-solution-four-lines-of-code-by-mikp-a5ji | Code #1\nTime complexity: O(fn + mn). Space complexity: O(mn). f - number of friendships, m - users, n - languages\n\nclass Solution:\n def minimumTeachings( | MikPosp | NORMAL | 2023-12-27T11:43:33.496371+00:00 | 2024-11-08T11:41:33.091681+00:00 | 148 | false | # Code #1\nTime complexity: $$O(f*n + m*n)$$. Space complexity: $$O(m*n)$$. f - number of friendships, m - users, n - languages\n```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n userToLang = {u:{*langs} for u,langs in enumerate(langu... | 8 | 0 | ['Array', 'Hash Table', 'Counting', 'Python', 'Python3'] | 0 |
minimum-number-of-people-to-teach | Intiution & Explanation with code & comments, beats 100% C++ | intiution-explanation-with-code-comments-n5n2 | To find the language to be taught to minimum number of people in real life, we can call the number of people who cant communicate with atleast one of their frie | parth2510 | NORMAL | 2021-01-23T21:00:18.656714+00:00 | 2021-01-23T21:00:18.656774+00:00 | 1,030 | false | To find the language to be taught to minimum number of people in real life, we can call the number of people who cant communicate with atleast one of their friend and of all of them can vote what is the most popular language among them, and those who dont know (minority) will learn it\n```\nclass Solution {\npublic:\n... | 8 | 1 | ['C'] | 0 |
minimum-number-of-people-to-teach | c++ easy solution using hashmap | c-easy-solution-using-hashmap-by-samiksh-bv61 | \nclass Solution {\npublic:\n bool intersection(vector<int>a,vector<int>b){\n for(int i=0;i<a.size();i++){\n for(int j=0;j<b.size();j++){\n | samiksha_1405 | NORMAL | 2021-01-24T11:45:49.457185+00:00 | 2021-01-24T11:45:49.457227+00:00 | 1,472 | false | ```\nclass Solution {\npublic:\n bool intersection(vector<int>a,vector<int>b){\n for(int i=0;i<a.size();i++){\n for(int j=0;j<b.size();j++){\n \n if(a[i]==b[j])return true;\n }\n \n }\n return false;\n }\n \n int minimumTeachings(int n,... | 4 | 0 | ['C', 'Ordered Set', 'C++'] | 2 |
minimum-number-of-people-to-teach | C++ hash table solution with explanation and comments | c-hash-table-solution-with-explanation-a-xaso | Idea:\n1. Check if there isn\'t common language for a friendship pair, then at least 1 person of the pair must be taught\n2. Count the number of such people (eg | eminem18753 | NORMAL | 2021-01-24T03:05:38.829562+00:00 | 2021-01-24T03:24:50.184830+00:00 | 167 | false | Idea:\n1. Check if there isn\'t common language for a friendship pair, then at least 1 person of the pair must be taught\n2. Count the number of such people (eg. those may need to be taught) who know a certain language and store them in a map\n-> mapping language to number of people who know it\n3. We can get the minim... | 4 | 0 | [] | 0 |
minimum-number-of-people-to-teach | [c++ 200ms 100%] bitset | c-200ms-100-bitset-by-summerzhou-u910 | 1 Use bitset to represent the languages of a user (bitset is very similar to a mask)\n2 Use bitset to test if two users has common langue, if not, we mark th | summerzhou | NORMAL | 2021-01-24T01:02:00.226053+00:00 | 2021-01-24T01:18:00.193925+00:00 | 334 | false | 1 Use bitset to represent the languages of a user (bitset is very similar to a mask)\n2 Use bitset to test if two users has common langue, if not, we mark the two user as candidate ( has at least one friend he can not talk to). \n Here we want to exclude all users that have no issue to talk to his/her friends.\n3... | 4 | 0 | [] | 1 |
minimum-number-of-people-to-teach | [Python3] Faster than 100% submissions in time and memory, detailed explanation step by step, | python3-faster-than-100-submissions-in-t-skz9 | \nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n """\n 1. Find out us | shot58 | NORMAL | 2021-01-23T17:58:18.804249+00:00 | 2021-01-24T08:52:24.272722+00:00 | 436 | false | ```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n """\n 1. Find out users who need to be taught\n 2. If no user needs to be taught, return 0\n 3. For all users who need to be taught a language, find the most popul... | 4 | 0 | ['Ordered Set', 'Python', 'Python3'] | 1 |
minimum-number-of-people-to-teach | C++ greedy simulate | c-greedy-simulate-by-navysealsniper-pw2v | \n\n int minimumTeachings(int n, vector>& languages, vector>& friendships) {\n \n\t\t\n\t\t// we save each users language id list into map, with id as | navysealsniper | NORMAL | 2021-01-23T16:49:06.556363+00:00 | 2021-01-23T18:36:21.486655+00:00 | 593 | false | \n\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n \n\t\t\n\t\t// we save each users language id list into map, with id as key\n std::map<int, set<int>> users;\n for(int i = 0; i < languages.size(); ++i) {\n for(auto& l : languages[i... | 4 | 0 | [] | 2 |
minimum-number-of-people-to-teach | Java Accepted Solution | java-accepted-solution-by-vikrant_pc-gxn5 | \nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n int result = languages.length;\n List<Set<I | vikrant_pc | NORMAL | 2021-01-23T16:02:24.030121+00:00 | 2021-01-23T16:17:04.087497+00:00 | 540 | false | ```\nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n int result = languages.length;\n List<Set<Integer>> langList = new ArrayList<>();\n for(int[] userLangs: languages) {\n Set<Integer> langSet = new HashSet<>();\n for(int u... | 4 | 1 | [] | 0 |
minimum-number-of-people-to-teach | Java detailed solution . Properly documented | java-detailed-solution-properly-document-s1lk | \nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n //This is the language map . Key is the person , T | noobpotatocoder | NORMAL | 2021-01-29T15:50:06.892848+00:00 | 2021-01-29T15:50:06.892898+00:00 | 450 | false | ```\nclass Solution {\n public int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n //This is the language map . Key is the person , The hashSet is the languages he can speak. We use a hashset to optimize the searching\n HashMap<Integer,HashSet<Integer>> languageMap = new HashMap<>()... | 3 | 1 | ['Java'] | 0 |
minimum-number-of-people-to-teach | Java Concise BitSet 98% | Problem Explanation | java-concise-bitset-98-problem-explanati-dn2r | Let\'s say we have an interger of 500 bits, then we can set the bit for each person for the language they speak, so if person A speaks langage 1 and 4 out of 4 | Student2091 | NORMAL | 2022-05-05T23:35:08.356490+00:00 | 2022-05-05T23:35:08.356540+00:00 | 273 | false | Let\'s say we have an interger of 500 bits, then we can set the bit for each person for the language they speak, so if person A speaks langage 1 and 4 out of 4 language, it\'d be represented as `0b1001`. We can then just `&` it with another person\'s number to find out if they share a common language.\n\nThe issue her... | 2 | 0 | ['Java'] | 0 |
minimum-number-of-people-to-teach | Python 3, Greedy, 95% time | python-3-greedy-95-time-by-huangshan01-4wb1 | \nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n # For all friends who canno | huangshan01 | NORMAL | 2021-11-29T05:22:33.966483+00:00 | 2021-11-30T04:40:05.548958+00:00 | 244 | false | ```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n # For all friends who cannot chat, find out the most common language they speak\n # Then teach the language to those unable to speak it, and return how many being taught\n ... | 2 | 0 | ['Greedy'] | 0 |
minimum-number-of-people-to-teach | C++ || Map | c-map-by-aparna_g-upyd | \nclass Solution {\npublic:\n bool findCommon(vector<int>&a, vector<int>&b) {\n for(int i=0;i<a.size();i++) {\n for(int j=0;j<b.size();j++) | aparna_g | NORMAL | 2021-06-21T12:35:25.780529+00:00 | 2021-06-21T12:35:25.780564+00:00 | 404 | false | ```\nclass Solution {\npublic:\n bool findCommon(vector<int>&a, vector<int>&b) {\n for(int i=0;i<a.size();i++) {\n for(int j=0;j<b.size();j++) {\n if(a[i]==b[j])\n return 1;\n }\n }\n return 0;\n }\n \n int minimumTeachings(int n, ... | 2 | 0 | ['C', 'C++'] | 0 |
minimum-number-of-people-to-teach | DSU rejected why? | dsu-rejected-why-by-siddharthraja9849-r6li | Can someone please guide me with this?\nI tried to detect cycle in the graph and then get most popular language amongst them.\nThen summition of abs(totalSizeOf | siddharthraja9849 | NORMAL | 2021-01-23T16:12:25.432703+00:00 | 2021-01-23T16:12:25.432745+00:00 | 258 | false | Can someone please guide me with this?\nI tried to detect cycle in the graph and then get most popular language amongst them.\nThen summition of abs(totalSizeOfConnectedComponents-frequencyOfUserKnowing a langauage) gives me answer\n```\n\n#define REP(i,a,b) for(int i=a;i<b;i++)\n\nclass Solution {\npublic:\n \n ... | 2 | 1 | [] | 1 |
minimum-number-of-people-to-teach | Python3 solution | python3-solution-by-mnikitin-h9qi | \nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n friends2commute = []\n | mnikitin | NORMAL | 2021-01-23T16:01:28.712642+00:00 | 2021-01-23T16:01:28.712679+00:00 | 235 | false | ```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n friends2commute = []\n for f1, f2 in friendships:\n if not list(set(languages[f1 - 1]) & set(languages[f2 - 1])):\n friends2commute.append([f1, f2])\n ... | 2 | 0 | [] | 0 |
minimum-number-of-people-to-teach | O(en) time, O(v + n) space | oen-time-ov-n-space-by-isaachaseley-3nim | Approach\n1. Find the friends who aren\'t able to communicate with someone\n2. Find the most common language among them\n3. Teach that to the rest of them \n\n# | isaachaseley | NORMAL | 2024-05-19T23:03:41.272472+00:00 | 2024-05-19T23:03:41.272490+00:00 | 27 | false | # Approach\n1. Find the friends who aren\'t able to communicate with someone\n2. Find the most common language among them\n3. Teach that to the rest of them \n\n# Complexity\n- Time complexity: O(en), where e is the number of edges and n is the number of languages\n\n- Space complexity: O(v + n), where v is the number ... | 1 | 0 | ['Python3'] | 0 |
minimum-number-of-people-to-teach | [C++] Hash Table, O((M+F)N) Runtime, O(MN) Memory | c-hash-table-omfn-runtime-omn-memory-by-29guo | \nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n int m = languages.size | amanmehara | NORMAL | 2024-05-13T09:32:06.570608+00:00 | 2024-05-13T09:53:19.949276+00:00 | 154 | false | ```\nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n int m = languages.size();\n vector<vector<char>> matrix(m + 1, vector<char>(n + 1, false));\n for (int i = 0; i < m; i++) {\n for (const auto& language : ... | 1 | 0 | ['Hash Table', 'Greedy', 'C++'] | 0 |
minimum-number-of-people-to-teach | JS || Solution by Bharadwaj | js-solution-by-bharadwaj-by-manu-bharadw-bkaq | Code\n\nvar minimumTeachings = function (n, languages, friendships) {\n let mostSpokenLanguages = new Array(n + 1).fill(0);\n let map = new Map();\n\n | Manu-Bharadwaj-BN | NORMAL | 2024-02-28T06:58:50.625671+00:00 | 2024-02-28T06:58:50.625700+00:00 | 27 | false | # Code\n```\nvar minimumTeachings = function (n, languages, friendships) {\n let mostSpokenLanguages = new Array(n + 1).fill(0);\n let map = new Map();\n\n friendships.forEach((element) => {\n let LANG = new Set(languages[element[0] - 1]);\n\n let shareLang = false;\n for (const l of langu... | 1 | 0 | ['JavaScript'] | 1 |
minimum-number-of-people-to-teach | C++ | c-by-avinash_4579-zj8w | 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 | avinash_4579 | NORMAL | 2024-01-17T03:36:00.675331+00:00 | 2024-01-17T03:36:00.675355+00:00 | 24 | 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-people-to-teach | Greedy Solution || O(m*n) || Faster than 60% || Clean code || Java | greedy-solution-omn-faster-than-60-clean-k9zp | Complexity\n- Time complexity: O(mn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(mn)\n Add your space complexity here, e.g. O(n) \n\n# | youssef1998 | NORMAL | 2023-08-01T20:31:30.669761+00:00 | 2023-08-01T20:31:30.669787+00:00 | 390 | false | # Complexity\n- Time complexity: $$O(m*n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(m*n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimport java.util.*;\nimport java.util.stream.Collectors;\n\nclass Solution {\n private final Map<Integer, Set<In... | 1 | 0 | ['Java'] | 0 |
minimum-number-of-people-to-teach | c++ | easy | step by step | c-easy-step-by-step-by-venomhighs7-2eic | \n# Code\n\nclass Solution {\npublic:\n\n\tvector<vector<int>> mem; \n bool check(vector<vector<int>>& a, int u, int v) {\n if(mem[u][v] != 0) return | venomhighs7 | NORMAL | 2022-10-01T04:42:19.778443+00:00 | 2022-10-01T04:42:19.778483+00:00 | 894 | false | \n# Code\n```\nclass Solution {\npublic:\n\n\tvector<vector<int>> mem; \n bool check(vector<vector<int>>& a, int u, int v) {\n if(mem[u][v] != 0) return mem[u][v] == 1;\n for(int i=0; i<a[v].size(); i++) {\n if(find(a[u].begin(), a[u].end(), a[v][i]) != a[u].end()) {\n mem[v]... | 1 | 0 | ['C++'] | 2 |
minimum-number-of-people-to-teach | Python | Set | python-set-by-sr_vrd-p9cc | \nclass Solution:\n def cantCommunicate(self, user1: int, user2: int, languages: List[Set[int]]) -> bool:\n \'\'\'\n returns True iff user1 and | sr_vrd | NORMAL | 2022-06-02T09:12:53.028893+00:00 | 2022-06-02T09:12:53.028917+00:00 | 362 | false | ```\nclass Solution:\n def cantCommunicate(self, user1: int, user2: int, languages: List[Set[int]]) -> bool:\n \'\'\'\n returns True iff user1 and user2 do not know any languages in common\n \'\'\'\n return len(languages[user1].intersection(languages[user2])) == 0\n \n def needToTea... | 1 | 0 | ['Ordered Set', 'Python'] | 1 |
minimum-number-of-people-to-teach | Brute force, 94% speed | brute-force-94-speed-by-evgenysh-62q1 | Runtime: 1352 ms, faster than 93.94%\nMemory Usage: 27.2 MB, less than 59.60%\n\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[in | evgenysh | NORMAL | 2021-07-13T18:48:19.635611+00:00 | 2021-07-13T18:48:19.635658+00:00 | 252 | false | Runtime: 1352 ms, faster than 93.94%\nMemory Usage: 27.2 MB, less than 59.60%\n```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n languages = [set(lst) for lst in languages]\n incommunicado_friends = set()\n for friend_1,... | 1 | 0 | ['Python', 'Python3'] | 0 |
minimum-number-of-people-to-teach | [Java] simple solution, beats 96.59% | java-simple-solution-beats-9659-by-octor-5v0p | \n\tpublic int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n\t\tint m = languages.length;\n\t\tboolean[][] speak = new boolean[m + 1][n + | octoray | NORMAL | 2021-02-26T06:01:02.175416+00:00 | 2021-02-26T16:58:37.683263+00:00 | 295 | false | ```\n\tpublic int minimumTeachings(int n, int[][] languages, int[][] friendships) {\n\t\tint m = languages.length;\n\t\tboolean[][] speak = new boolean[m + 1][n + 1];\n\t\tboolean[][] teach = new boolean[m + 1][n + 1];\n\t\tfor (int user = 0; user < m; user++) {\n\t\t\tint[] userLanguages = languages[user];\n\t\t\tfor ... | 1 | 1 | [] | 0 |
minimum-number-of-people-to-teach | [Python3] count properly | python3-count-properly-by-ye15-aoy3 | Algo\nWe collect those who cannot communicate and find the most languages among them. Teach the language to those who haven\'t spoken it yet. \n\nImplementation | ye15 | NORMAL | 2021-02-10T22:56:19.595494+00:00 | 2021-02-10T22:56:19.595534+00:00 | 174 | false | **Algo**\nWe collect those who cannot communicate and find the most languages among them. Teach the language to those who haven\'t spoken it yet. \n\n**Implementation**\n```\nclass Solution:\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n m = len(langua... | 1 | 0 | ['Python3'] | 0 |
minimum-number-of-people-to-teach | C++ Self Explanatory Code | c-self-explanatory-code-by-prayag410-qck5 | \nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n int m = languages.size | prayag410 | NORMAL | 2021-02-09T07:04:13.069805+00:00 | 2021-02-09T07:04:13.069846+00:00 | 251 | false | ```\nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n int m = languages.size();\n vector<set<int>> lang(m+1);\n for(int i=0; i<languages.size(); i++){\n for(int j=0;j<languages[i].size();j++){\n ... | 1 | 0 | [] | 0 |
minimum-number-of-people-to-teach | Simple C++ Solution | simple-c-solution-by-c0d1ngphenomena-blwu | \nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n set<int> arr;\n | C0d1ngPhenomena | NORMAL | 2021-01-24T15:36:20.380150+00:00 | 2021-01-24T15:36:58.455948+00:00 | 93 | false | ```\nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n set<int> arr;\n \n //to store languages known by ith user\n unordered_map<int, map<int, int>> mp;\n \n for(int i = 0; i < languages.size(); i++)... | 1 | 0 | [] | 0 |
minimum-number-of-people-to-teach | C++ bitmap with pruning 188 ms | c-bitmap-with-pruning-188-ms-by-crackiv-4wr5 | Step 1: If two friends already speak the same language, we don\'t need to include them in the second step.\nStep 2: iterater all languages and check if the user | crackiv | NORMAL | 2021-01-24T05:18:02.120322+00:00 | 2021-01-24T05:21:25.286208+00:00 | 136 | false | Step 1: If two friends already speak the same language, we don\'t need to include them in the second step.\nStep 2: iterater all languages and check if the user speaks it. If not, set the bit and increase the user_count.\n\n```\nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, ... | 1 | 0 | [] | 0 |
minimum-number-of-people-to-teach | Graph thought disappointed a lot! | graph-thought-disappointed-a-lot-by-sidd-2iq6 | The code has good naming of variables to understand please check it out!!\nDisappointed with the problem a lot ! \n\n\nclass Solution {\npublic:\n int minimu | siddharthraja9849 | NORMAL | 2021-01-24T02:15:23.317207+00:00 | 2021-01-24T02:18:12.200095+00:00 | 148 | false | The code has good naming of variables to understand please check it out!!\nDisappointed with the problem a lot ! \n```\n\nclass Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n set<int>peopleNotCommunicate;\n \n for(auto ele:... | 1 | 1 | ['C', 'Ordered Set'] | 0 |
minimum-number-of-people-to-teach | javascript 176ms | javascript-176ms-by-henrychen222-yput | \nconst minimumTeachings = (n, languages, friendships) => {\n let ln = languages.length;\n let canCommunicate = initialize2DArrayNew(ln, n);\n for (let | henrychen222 | NORMAL | 2021-01-24T01:49:26.106289+00:00 | 2021-01-24T01:49:26.106316+00:00 | 144 | false | ```\nconst minimumTeachings = (n, languages, friendships) => {\n let ln = languages.length;\n let canCommunicate = initialize2DArrayNew(ln, n);\n for (let l = 0; l < ln; l++) {\n for (const x of languages[l]) {\n canCommunicate[l][x - 1] = true;\n }\n }\n let set = new Set();\n ... | 1 | 0 | ['JavaScript'] | 0 |
minimum-number-of-people-to-teach | python 7-lines | python-7-lines-by-darktiantian-wvuq | python\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n lang = [0] + list(map(set, languages)) | darktiantian | NORMAL | 2021-01-23T17:16:16.356703+00:00 | 2021-01-23T17:16:35.103648+00:00 | 138 | false | ```python\n def minimumTeachings(self, n: int, languages: List[List[int]], friendships: List[List[int]]) -> int:\n lang = [0] + list(map(set, languages))\n uncom = set() # someone may need learn new language\n for a, b in friendships:\n if not (lang[a] & lang[b]):\n ... | 1 | 0 | ['Python'] | 0 |
minimum-number-of-people-to-teach | Java Solution with comments | java-solution-with-comments-by-husilan-d76r | Iterate all the friendships to find the pair that don\'t have common lanagues\n2. If they don\'t have common lanagues, then check if this person is already in t | husilan | NORMAL | 2021-01-23T16:48:39.395359+00:00 | 2021-01-23T16:48:39.395386+00:00 | 109 | false | 1. Iterate all the friendships to find the pair that don\'t have common lanagues\n2. If they don\'t have common lanagues, then check if this person is already in the set or not\n3. If it\'s not then add the lanagues of that person to the count array.\n4. Greedy choose the max languages (this is the languages for the fr... | 1 | 0 | [] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.