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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ambiguous-coordinates | Java Backtracking Approach | java-backtracking-approach-by-kavin_kuma-cln7 | 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 | Kavin_Kumaran_Mad | NORMAL | 2024-05-05T12:02:51.001269+00:00 | 2024-05-05T12:02:51.001287+00:00 | 55 | 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 | ['Backtracking', 'Java'] | 0 |
ambiguous-coordinates | 816. Ambiguous Coordinates.cpp | 816-ambiguous-coordinatescpp-by-202021ga-2fex | Code\n\nclass Solution {\npublic:\n vector<string> ambiguousCoordinates(string S) {\n for (int i = 2; i < S.size() - 1; i++) {\n string str | 202021ganesh | NORMAL | 2024-04-14T09:26:07.980038+00:00 | 2024-04-14T09:26:07.980059+00:00 | 4 | false | **Code**\n```\nclass Solution {\npublic:\n vector<string> ambiguousCoordinates(string S) {\n for (int i = 2; i < S.size() - 1; i++) {\n string strs[2] = {S.substr(1,i-1), S.substr(i,S.size()-i-1)};\n xPoss.clear();\n for (int j = 0; j < 2; j++)\n if (xPoss.size(... | 0 | 0 | ['C'] | 0 |
ambiguous-coordinates | dry-hard impl | dry-hard-impl-by-wangcai20-bpvb | Intuition\n Describe your first thoughts on how to solve this problem. \nSplit string to pair combinations (1d list) - O(s length -1)\nFurther break down each p | wangcai20 | NORMAL | 2024-04-06T02:17:15.535989+00:00 | 2024-04-06T02:17:15.536028+00:00 | 10 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSplit string to pair combinations (1d list) - O(s length -1)\nFurther break down each pair to varition combinations (2d list) - O((left len -1)*(right len) -1)\n~ O(m^3) m is the length of s\n\n# Approach\n<!-- Describe your approach to s... | 0 | 0 | ['Java'] | 0 |
ambiguous-coordinates | Easy to understand C# solution - Beats 94.74% | easy-to-understand-c-solution-beats-9474-wkdd | Intuition\nThe problem can be approached by splitting the input string into two parts and then generating all possible combinations of valid numbers for each pa | zeeabutt | NORMAL | 2024-03-28T07:16:56.473031+00:00 | 2024-03-28T07:16:56.473065+00:00 | 5 | false | # Intuition\nThe problem can be approached by splitting the input string into two parts and then generating all possible combinations of valid numbers for each part. To generate valid numbers, we iterate through each possible split point and consider all valid integer and fractional parts. Finally, we construct valid c... | 0 | 0 | ['C#'] | 0 |
ambiguous-coordinates | Java Solution | java-solution-by-ndsjqwbbb-14na | 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 | ndsjqwbbb | NORMAL | 2024-03-25T20:57:17.848219+00:00 | 2024-03-25T20:57:17.848242+00:00 | 14 | 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 | ['Java'] | 0 |
ambiguous-coordinates | Ambiguous Coordinates || Backtracking || C# || Beats 94.44% || | ambiguous-coordinates-backtracking-c-bea-nkwr | Rules to Consider.\n1. Has Two parts and each of these two parts contains at most 1 decimal\n2. Any non decimal part will not start with 0, if the part itsel is | diptesh308 | NORMAL | 2024-03-23T16:13:22.920143+00:00 | 2024-03-23T16:17:45.501587+00:00 | 2 | false | # Rules to Consider.\n1. Has Two parts and each of these two parts contains at most 1 decimal\n2. Any non decimal part will not start with 0, if the part itsel isn\'t 0. (Example : (**005**, 4) is not allowed because 005 starts with 0, but (0, 4) is allowed)\n3. Decimal strings **can not end with a 0**, so **0.10, 0.0,... | 0 | 0 | ['C#'] | 0 |
ambiguous-coordinates | C# simple coordinates parsing | 90ms 100% | c-simple-coordinates-parsing-90ms-100-by-jx5h | Code\n\npublic class Solution {\n public IList<string> AmbiguousCoordinates(string s) \n {\n var chars = s.ToCharArray();\n\n var r = new Li | Legon2k | NORMAL | 2024-03-16T05:37:57.917422+00:00 | 2024-03-16T05:49:04.678144+00:00 | 1 | false | # Code\n```\npublic class Solution {\n public IList<string> AmbiguousCoordinates(string s) \n {\n var chars = s.ToCharArray();\n\n var r = new List<string>();\n\n for(var i = 2; i < s.Length - 1; i++)\n {\n var l2 = GetCoordinates(s, chars, i, s.Length-1);\n\n if(... | 0 | 0 | ['C#'] | 0 |
ambiguous-coordinates | Overly complicated custom iterator solution | overly-complicated-custom-iterator-solut-krdv | Code\n\nimpl Solution {\n pub fn ambiguous_coordinates(s: String) -> Vec<String> {\n let mut ans = vec![];\n let s = &s[1..s.len() - 1];\n | BitUnWise | NORMAL | 2024-03-09T04:25:23.507565+00:00 | 2024-03-09T04:25:23.507582+00:00 | 3 | false | # Code\n```\nimpl Solution {\n pub fn ambiguous_coordinates(s: String) -> Vec<String> {\n let mut ans = vec![];\n let s = &s[1..s.len() - 1];\n for i in 1..s.len() {\n let (left, right) = s.split_at(i);\n let left: SeperatorIterator = left.into();\n let right: Se... | 0 | 0 | ['Rust'] | 0 |
ambiguous-coordinates | Short Go Solution | short-go-solution-by-quoderat-iabx | \nimport "fmt"\n\nfunc ambiguousCoordinates(s string) []string {\n\tresults := []string{}\n\ts = s[1 : len(s)-1]\n\tfor c := 1; c < len(s); c++ {\n\t\tp2s := am | quoderat | NORMAL | 2024-02-17T01:58:36.017245+00:00 | 2024-02-17T01:58:36.017263+00:00 | 4 | false | ```\nimport "fmt"\n\nfunc ambiguousCoordinates(s string) []string {\n\tresults := []string{}\n\ts = s[1 : len(s)-1]\n\tfor c := 1; c < len(s); c++ {\n\t\tp2s := ambiguousNumber(s[c:])\n\t\tfor _, p1 := range ambiguousNumber(s[:c]) {\n\t\t\tfor _, p2 := range p2s {\n\t\t\t\tresults = append(results, fmt.Sprintf("(%s, %s... | 0 | 0 | ['Go'] | 0 |
ambiguous-coordinates | Not a good question. Intuitive solution. | not-a-good-question-intuitive-solution-b-61ok | Intuition\nThis is the worst kind of questions on Leetcode. It has nothing to do with any algorithm or data structure worth practicing, but adds layers and laye | trunkunala | NORMAL | 2024-02-02T00:45:23.421559+00:00 | 2024-02-02T00:45:23.421580+00:00 | 9 | false | # Intuition\nThis is the worst kind of questions on Leetcode. It has nothing to do with any algorithm or data structure worth practicing, but adds layers and layers of difficulties that are tricky to resolve. \n\nSo basically the idea is to split the string into two parts, convert each part into an acceptable form and ... | 0 | 0 | ['Java'] | 0 |
ambiguous-coordinates | TS Solution | ts-solution-by-gennadysx-zxqp | 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 | GennadySX | NORMAL | 2024-01-25T08:37:07.659227+00:00 | 2024-01-25T08:37:07.659246+00:00 | 4 | 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 | ['TypeScript'] | 0 |
ambiguous-coordinates | Python Medium | python-medium-by-lucasschnee-vv0o | \nclass Solution:\n def ambiguousCoordinates(self, s: str) -> List[str]:\n t = ""\n for char in s:\n if char not in "()":\n | lucasschnee | NORMAL | 2024-01-19T17:20:17.589150+00:00 | 2024-01-19T17:20:17.589176+00:00 | 15 | false | ```\nclass Solution:\n def ambiguousCoordinates(self, s: str) -> List[str]:\n t = ""\n for char in s:\n if char not in "()":\n t += char\n \n \n s = t\n \n N = len(s)\n \n self.options = set()\n \n ... | 0 | 0 | ['Python3'] | 0 |
ambiguous-coordinates | C# Fast & Clean Solution Time: 107 ms (100.00%), Space: 61.4 MB (33.33%) | c-fast-clean-solution-time-107-ms-10000-1s182 | \npublic class Solution \n{\n private bool IsLegal(string num)\n {\n //\'1\' \'.\'\n if(num.Length == 1) return num != ".";\n \n | sighyu | NORMAL | 2023-12-21T23:12:28.545102+00:00 | 2023-12-21T23:12:28.545124+00:00 | 4 | false | ```\npublic class Solution \n{\n private bool IsLegal(string num)\n {\n //\'1\' \'.\'\n if(num.Length == 1) return num != ".";\n \n //\'00\' \'001\' \'00.01\'\n if(num[0] == \'0\' && num[1] == \'0\') return false;\n \n int decimalPointIdx = num.IndexOf(\'.\');\n ... | 0 | 0 | [] | 0 |
ambiguous-coordinates | Why the downvotes? Clean code - Python/Java | why-the-downvotes-clean-code-pythonjava-gu3fq | Intuition\n\nThis question definitely doesn\'t deserve so many downvotes. The edge cases may seem bad initially, but in code it\'s only a couple if elif conditi | katsuki-bakugo | NORMAL | 2023-12-15T02:41:34.608930+00:00 | 2023-12-17T00:55:43.579535+00:00 | 30 | false | > # Intuition\n\nThis question definitely doesn\'t deserve so many downvotes. The edge cases may seem bad initially, but in code it\'s only a couple `if elif` conditionals to make this pass.\n\nMy initial thoughts with this question were [Leetcode 22](https://leetcode.com/problems/generate-parentheses/description/). Bu... | 0 | 0 | ['String', 'Python', 'Java', 'Python3'] | 0 |
ambiguous-coordinates | Ambiguous Coordinates || JAVASCRIPT || Solution by Bharadwaj | ambiguous-coordinates-javascript-solutio-nq2a | Approach\nBrute Force\n\n# Complexity\n- Time complexity:\nO(n^4)\n\n- Space complexity:\nO(n^2)\n\n# Code\n\nvar ambiguousCoordinates = function(s) {\n let a | Manu-Bharadwaj-BN | NORMAL | 2023-11-27T11:48:56.358182+00:00 | 2023-11-27T11:48:56.358203+00:00 | 2 | false | # Approach\nBrute Force\n\n# Complexity\n- Time complexity:\nO(n^4)\n\n- Space complexity:\nO(n^2)\n\n# Code\n```\nvar ambiguousCoordinates = function(s) {\n let ans = [];\n for(let i = 2; i < s.length - 1; i++){\n let left = s.slice(1, i);\n let right = s.slice(i, s.length - 1);\n\n let ls = [lef... | 0 | 0 | ['JavaScript'] | 0 |
ambiguous-coordinates | ✅simple iterative solution || python | simple-iterative-solution-python-by-dark-3l72 | \n# Code\n\nclass Solution:\n\n def check(self,s):\n i=0\n j=len(s)-1\n if(s[i]==\'(\'):i+=1\n elif(s[j]==\')\'):j-=1\n s= | darkenigma | NORMAL | 2023-09-30T09:23:34.881389+00:00 | 2023-09-30T09:23:34.881413+00:00 | 23 | false | \n# Code\n```\nclass Solution:\n\n def check(self,s):\n i=0\n j=len(s)-1\n if(s[i]==\'(\'):i+=1\n elif(s[j]==\')\'):j-=1\n s=s[i:j+1]\n k=s.find(".")\n if(k!=-1):\n if(1<k and s[0]==\'0\'):return 0 \n if(s[len(s)-1]==\'0\'):return 0\n ... | 0 | 0 | ['String', 'Python3'] | 0 |
ambiguous-coordinates | C# annoying validation 😒 | c-annoying-validation-by-valtss-hql3 | Intuition\n Describe your first thoughts on how to solve this problem. \nBrute force with validation of generated numbers.\n\n# Approach\n Describe your approac | valtss | NORMAL | 2023-09-25T20:33:25.341871+00:00 | 2023-09-25T20:33:54.514186+00:00 | 13 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nBrute force with validation of generated numbers.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Split input into 2 parts (left & right) process each in seperation.\n- Combine results in nested loop.\n- Call fun... | 0 | 0 | ['C#'] | 0 |
ambiguous-coordinates | Go solution with comments | go-solution-with-comments-by-dchooyc-81nr | \nfunc ambiguousCoordinates(s string) []string {\n res := []string{}\n // remove parenthesis\n s = s[1:len(s) - 1]\n\n for i := 1; i < len(s); i++ { | dchooyc | NORMAL | 2023-09-15T19:02:45.169967+00:00 | 2023-09-15T19:02:45.169993+00:00 | 13 | false | ```\nfunc ambiguousCoordinates(s string) []string {\n res := []string{}\n // remove parenthesis\n s = s[1:len(s) - 1]\n\n for i := 1; i < len(s); i++ {\n // generate possible x coordinates based on split\n lefts := gen(s, 0, i)\n // generate possible y coordinates based on split\n ... | 0 | 0 | ['Go'] | 0 |
ambiguous-coordinates | [Python] Solution + explanation | python-solution-explanation-by-ngrishano-0u1x | We can split this problem into two subproblems:\n1. Get all the possible values for coordinates substring (102 -> [1.02, 10.2, 102], 00 -> [])\n2. Get all the p | ngrishanov | NORMAL | 2023-09-10T20:12:44.970072+00:00 | 2023-09-10T20:12:44.970092+00:00 | 27 | false | We can split this problem into two subproblems:\n1. Get all the possible values for coordinates substring (`102` -> `[1.02, 10.2, 102]`, `00` -> `[]`)\n2. Get all the possible combinations for two coordinates substrings\n\nFor the first subproblem, refer to `variants` function. It should be self-explanatory: we iterate... | 0 | 0 | ['Python3'] | 0 |
ambiguous-coordinates | Easiest Solution | easiest-solution-by-kunal7216-2eai | \n\n# Code\njava []\n// the constraints are really small so we can use brute force , rest of the code is self explanatory\n\nclass Solution {\n public List<S | Kunal7216 | NORMAL | 2023-09-08T13:18:05.426823+00:00 | 2023-09-08T13:18:05.426840+00:00 | 31 | false | \n\n# Code\n```java []\n// the constraints are really small so we can use brute force , rest of the code is self explanatory\n\nclass Solution {\n public List<String> ambiguousCoordinates(String s) {\n String str = s.substring(1,s.length()-1); // remove brackets from the expression to make it easier to proces... | 0 | 0 | ['C++', 'Java'] | 0 |
ambiguous-coordinates | Very simple Intuition solution || C++ | very-simple-intuition-solution-c-by-rkku-ic39 | Complexity\n- Time complexity: O(N^3)\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# | rkkumar421 | NORMAL | 2023-06-16T08:26:53.214302+00:00 | 2023-06-16T08:29:14.059038+00:00 | 70 | false | # Complexity\n- Time complexity: O(N^3)\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 \n void solve(vector<string> &ans, string &a, string &b){\n // Here we have to valid... | 0 | 0 | ['String', 'C++'] | 0 |
ambiguous-coordinates | Easy division | easy-division-by-xjpig-hsrf | Intuition\n Describe your first thoughts on how to solve this problem. \nsuppose s=pre+suf, the corresponding coordinates include the join of all possible divis | XJPIG | NORMAL | 2023-06-03T08:16:39.234528+00:00 | 2023-06-03T08:16:39.234571+00:00 | 52 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nsuppose s=pre+suf, the corresponding coordinates include the join of all possible divisions of pre/suf. Note that, for any pre/suf, it is not valid for division if the length of it is larger than 1 and both the front and end of it are \'0... | 0 | 0 | ['C++'] | 0 |
ambiguous-coordinates | Solution in C++ | solution-in-c-by-ashish_madhup-u90n | 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 | ashish_madhup | NORMAL | 2023-05-29T10:01:55.859590+00:00 | 2023-05-29T10:01:55.859640+00:00 | 55 | 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 |
ambiguous-coordinates | Python3 - Ye Olde One Liner | python3-ye-olde-one-liner-by-godshiva-e7cr | Intuition\nCuz why not?\n\n# Code\n\nclass Solution:\n def ambiguousCoordinates(self, s: str) -> List[str]:\n return [f"({x}, {y})" for d in [lambda n | godshiva | NORMAL | 2023-05-29T04:33:06.910105+00:00 | 2023-05-29T04:33:06.910141+00:00 | 39 | false | # Intuition\nCuz why not?\n\n# Code\n```\nclass Solution:\n def ambiguousCoordinates(self, s: str) -> List[str]:\n return [f"({x}, {y})" for d in [lambda n: [x for x in [f"{n[:i]}.{n[i:]}".strip(\'.\') for i in range(1, len(n)+1)] if (\'.\' not in x or x[-1] != \'0\') and x[:2] != \'00\' and (x[0] != \'0\' o... | 0 | 0 | ['Python3'] | 0 |
ambiguous-coordinates | [Accepted] Swift | accepted-swift-by-vasilisiniak-3nn0 | \nclass Solution {\n func ambiguousCoordinates(_ s: String) -> [String] {\n\n func lr(_ s: String) -> [(String, String)] {\n (1..<s.count). | vasilisiniak | NORMAL | 2023-04-08T08:17:54.050494+00:00 | 2023-04-08T08:17:54.050533+00:00 | 50 | false | ```\nclass Solution {\n func ambiguousCoordinates(_ s: String) -> [String] {\n\n func lr(_ s: String) -> [(String, String)] {\n (1..<s.count).map { (String(s.prefix($0)), String(s.dropFirst($0))) }\n }\n\n func opts(_ s: String) -> [String] {\n guard !s.hasPrefix("00") || s... | 0 | 0 | ['Swift'] | 0 |
ambiguous-coordinates | I ❤ Ruby | i-ruby-by-0x81-cmdx | ruby\ndef ambiguous_coordinates s\n f = -> s do\n r, z = [s], s.size\n return r if z == 1\n return (s[/^0/] ? [] : r) if s[/0$/]\n | 0x81 | NORMAL | 2023-03-29T13:30:05.921684+00:00 | 2023-03-29T13:30:05.921718+00:00 | 40 | false | ```ruby\ndef ambiguous_coordinates s\n f = -> s do\n r, z = [s], s.size\n return r if z == 1\n return (s[/^0/] ? [] : r) if s[/0$/]\n return [\'0.\' + s[1..]] if s[/^0/]\n (1...z).reduce(r) { _1 << s.clone.insert(_2, ?.) }\n end\n (1...(s = s[1..-2]).size).flat_map do | i |\n... | 0 | 0 | ['Ruby'] | 0 |
ambiguous-coordinates | C++ | c-by-tinachien-0xew | \nclass Solution {\nprivate:\n vector<string>splits(string s){\n if(s.size() == 0)\n return {} ;\n if(s.size() > 1 && s[0] == \'0\' | TinaChien | NORMAL | 2023-03-28T11:33:40.916237+00:00 | 2023-03-28T11:33:40.916280+00:00 | 54 | false | ```\nclass Solution {\nprivate:\n vector<string>splits(string s){\n if(s.size() == 0)\n return {} ;\n if(s.size() > 1 && s[0] == \'0\' && s.back() == \'0\')\n return {} ;\n if(s.back() == \'0\')\n return {s} ;\n if(s.front() == \'0\')\n return {... | 0 | 0 | [] | 0 |
find-the-number-of-good-pairs-i | Java EASY Solution for Beginners [ 99.96% ] [ 1ms ] | java-easy-solution-for-beginners-9996-1m-e36v | Approach\n1. Initialize Counter:\n - Create a variable count to store the number of valid pairs.\n\n2. Outer Loop:\n - Iterate through each element i in num | RajarshiMitra | NORMAL | 2024-05-29T16:47:09.898898+00:00 | 2024-06-16T06:43:26.825504+00:00 | 1,072 | false | # Approach\n1. **Initialize Counter**:\n - Create a variable `count` to store the number of valid pairs.\n\n2. **Outer Loop**:\n - Iterate through each element `i` in `nums1`.\n\n3. **Inner Loop**:\n - For each element `i` in `nums1`, iterate through each element `j` in `nums2`.\n\n4. **Check Condition**:\n - C... | 13 | 0 | ['Java'] | 2 |
find-the-number-of-good-pairs-i | Python 3 || 4 lines, filter nums1 and count || T/S: 98% / 61% | python-3-4-lines-filter-nums1-and-count-ky3a1 | \nclass Solution:\n def numberOfPairs(self, nums1: List[int], \n nums2: List[int], k: int, ans = 0) -> int:\n\n nums1 = lis | Spaulding_ | NORMAL | 2024-05-26T04:10:36.402442+00:00 | 2024-05-31T05:47:14.472523+00:00 | 855 | false | ```\nclass Solution:\n def numberOfPairs(self, nums1: List[int], \n nums2: List[int], k: int, ans = 0) -> int:\n\n nums1 = list(map(lambda x: x//k, filter(lambda x: x%k == 0, nums1)))\n \n for n1, n2 in product(nums1, nums2):\n \n if n1%n2 == 0: a... | 10 | 0 | ['Python3'] | 1 |
find-the-number-of-good-pairs-i | Simple java solution | simple-java-solution-by-siddhant_1602-heag | Complexity\n- Time complexity: O(n^2)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) { | Siddhant_1602 | NORMAL | 2024-05-26T04:08:27.519795+00:00 | 2024-05-26T04:08:27.519815+00:00 | 894 | false | # Complexity\n- Time complexity: $$O(n^2)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int count=0;\n for(int i=0;i<nums1.length;i++)\n {\n for(int j=0;j<nums2.length;j++)\n {\n ... | 9 | 2 | ['Java'] | 2 |
find-the-number-of-good-pairs-i | Simple And Easy Solution | simple-and-easy-solution-by-kg-profile-idda | Code\n\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n c = 0\n for i in range(len(nums1)):\n | KG-Profile | NORMAL | 2024-05-26T04:04:08.241513+00:00 | 2024-05-26T04:04:08.241546+00:00 | 1,710 | false | # Code\n```\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n c = 0\n for i in range(len(nums1)):\n for j in range(len(nums2)):\n if nums1[i] % (nums2[j] * k) == 0:\n c += 1\n return c\n``` | 9 | 0 | ['Python3'] | 1 |
find-the-number-of-good-pairs-i | Assembly with explanation and comparison with C | assembly-with-explanation-and-comparison-5wdf | \n# Rationale\n\nI\'ve solved this LeetCode problem using inline assembly in C. My goal isn\'t to showcase complexity, but rather to challenge myself and deepen | pcardenasb | NORMAL | 2024-06-13T23:46:58.410365+00:00 | 2024-06-13T23:46:58.410383+00:00 | 150 | false | \n# Rationale\n\nI\'ve solved this LeetCode problem using inline assembly in C. My goal isn\'t to showcase complexity, but rather to challenge myself and deepen my understanding of assembly language. \n\nAs a beginner in assembly, I welcome any improvements or comments on my code.\n\nAdditionally, I aim to share insigh... | 6 | 0 | ['C'] | 2 |
find-the-number-of-good-pairs-i | Beats 100.00% of users with Python3 | beats-10000-of-users-with-python3-by-kaw-7l8d | 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 | KawinP | NORMAL | 2024-05-27T17:22:29.709857+00:00 | 2024-05-27T17:22:29.709880+00:00 | 328 | 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)$$ --... | 6 | 0 | ['Python3'] | 1 |
find-the-number-of-good-pairs-i | Simple Brute-force & optimal solution | simple-brute-force-optimal-solution-by-k-rked | Here is the better solution then bruteforce approach : https://leetcode.com/problems/find-the-number-of-good-pairs-ii/solutions/5208919/check-all-factors-of-num | kreakEmp | NORMAL | 2024-05-26T04:03:15.533972+00:00 | 2024-05-26T04:17:12.070614+00:00 | 1,344 | false | Here is the better solution then bruteforce approach : https://leetcode.com/problems/find-the-number-of-good-pairs-ii/solutions/5208919/check-all-factors-of-nums1/\n\n# Code\n```\nint numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int ans = 0;\n for(int i = 0; i < nums1.size(); ++i){\n fo... | 6 | 1 | ['C++'] | 1 |
find-the-number-of-good-pairs-i | Python Elegant & Short | 1-Line | Pairwise | python-elegant-short-1-line-pairwise-by-apcsb | Complexity\n- Time complexity: O(n * m)\n- Space complexity: O(1)\n\n# Code\npython []\nclass Solution:\n def numberOfPairs(self, first: list[int], second: l | Kyrylo-Ktl | NORMAL | 2024-05-27T12:51:58.256153+00:00 | 2024-05-27T12:52:16.080487+00:00 | 347 | false | # Complexity\n- Time complexity: $$O(n * m)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```python []\nclass Solution:\n def numberOfPairs(self, first: list[int], second: list[int], k: int) -> int:\n return sum(a % (b * k) == 0 for a, b in product(first, second))\n``` | 4 | 0 | ['Python3'] | 1 |
find-the-number-of-good-pairs-i | Beats 100% users... Dominate others with this code.. | beats-100-users-dominate-others-with-thi-cy66 | \n# Code\n\n\'\'\'class Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n\'\'\' \nclass Solution:\n def numberOfP | Aim_High_212 | NORMAL | 2024-05-27T02:08:08.077646+00:00 | 2024-05-27T02:08:08.077669+00:00 | 596 | false | \n# Code\n```\n\'\'\'class Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n\'\'\' \nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n c = 0\n for i in range(len(nums1)):\n for j in range(len(nums2)):\n... | 3 | 0 | ['C', 'Python', 'Java', 'Python3'] | 0 |
find-the-number-of-good-pairs-i | simple and easy C++ solution 😍❤️🔥 | simple-and-easy-c-solution-by-shishirrsi-en6e | if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k | shishirRsiam | NORMAL | 2024-05-26T05:56:05.647644+00:00 | 2024-05-26T05:56:05.647660+00:00 | 1,020 | false | # if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n\n# Code\n```\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) \n {\n int ans = 0, div;\n for(auto val:nums1)\n {\n for(auto v:nums2)\n {\n div = v * k;\n ... | 3 | 0 | ['Array', 'Math', 'C++'] | 4 |
find-the-number-of-good-pairs-i | C++ || Easy || 5 Lines | c-easy-5-lines-by-dibendu07-gbha | 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 | dibendu07 | NORMAL | 2024-05-26T04:03:56.350063+00:00 | 2024-05-26T04:03:56.350088+00:00 | 528 | 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:O(N*M)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $... | 3 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | MOST EASIEST PYTHON SOLUTION🔥🔥🔥 || BEGINNER FRIENDLY APPROACH | most-easiest-python-solution-beginner-fr-nmgq | Intuition\nThe problem likely involves finding pairs from two arrays nums1 and nums2 such that the elements in the pair satisfy a given condition. Specifically, | FAHAD_26 | NORMAL | 2024-09-24T19:18:52.351070+00:00 | 2024-09-24T19:18:52.351109+00:00 | 48 | false | # Intuition\nThe problem likely involves finding pairs from two arrays nums1 and nums2 such that the elements in the pair satisfy a given condition. Specifically, for each pair (nums1[i], nums2[j]), you\'re tasked with determining whether nums1[i] is divisible by nums2[j] * k (where k is an integer parameter provided).... | 2 | 0 | ['Python'] | 0 |
find-the-number-of-good-pairs-i | :D | d-by-yesyesem-xvu9 | 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 | yesyesem | NORMAL | 2024-08-24T19:10:20.334856+00:00 | 2024-08-24T19:10:20.334880+00:00 | 169 | 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)$$ --... | 2 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | 99.94% beats solution in java | 9994-beats-solution-in-java-by-mantosh_k-yjxe | \n\n# Code\n\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n \n int no_of_good_pair=0;\n for( int i=0; | mantosh_kumar04 | NORMAL | 2024-06-14T16:30:50.890593+00:00 | 2024-06-14T16:30:50.890632+00:00 | 296 | false | \n\n# Code\n```\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n \n int no_of_good_pair=0;\n for( int i=0; i<nums1.length; i++)\n {\n for( int j=0; j<nums2.length; j++)\n {\n if(nums1[i]%(nums2[j]*k)==0){\n ... | 2 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | Easiest Solution! | easiest-solution-by-saara208-txwy | 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 | saara208 | NORMAL | 2024-06-13T16:17:51.193851+00:00 | 2024-06-13T16:17:51.193881+00:00 | 119 | 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)$$ --... | 2 | 0 | ['Java'] | 1 |
find-the-number-of-good-pairs-i | Solution by Dare2Solve | Detail Explanation | O(n * sqrt(max(x))) | solution-by-dare2solve-detail-explanatio-lgwz | Explanation []\nauthorslog.vercel.app/blog/H8FBC3F9WU\n\n\n# Code\n\nC++ []\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& n | Dare2Solve | NORMAL | 2024-06-08T11:49:16.699815+00:00 | 2024-06-08T11:56:35.411923+00:00 | 707 | false | ```Explanation []\nauthorslog.vercel.app/blog/H8FBC3F9WU\n```\n\n# Code\n\n```C++ []\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n unordered_map<int, int> map1;\n unordered_map<int, int> map2;\n\n for (int x : nums1) {\n if (x % k ==... | 2 | 0 | ['Hash Table', 'Python', 'C++', 'Java', 'Go', 'Python3', 'JavaScript', 'C#'] | 1 |
find-the-number-of-good-pairs-i | easy solution in all languages with their runtime (ms) - guess which is the fastest(this solution) | easy-solution-in-all-languages-with-thei-9mh1 | go - 0ms\n- java - 1ms\n- c++ - 6ms\n- python - 24ms\n- python3 - 53ms\n- javasript - 74ms\n- dart - 413ms\n\n\npython3 []\nclass Solution:\n def numberOfPai | Sajal_ | NORMAL | 2024-05-30T04:46:21.901080+00:00 | 2024-05-30T04:46:21.901100+00:00 | 691 | false | - go - 0ms\n- java - 1ms\n- c++ - 6ms\n- python - 24ms\n- python3 - 53ms\n- javasript - 74ms\n- dart - 413ms\n\n\n```python3 []\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n count = 0\n for i in nums1:\n for j in nums2:\n if i... | 2 | 0 | ['Array', 'C', 'Python', 'C++', 'Java', 'Go', 'Python3', 'JavaScript', 'C#', 'Dart'] | 0 |
find-the-number-of-good-pairs-i | different language solutions | different-language-solutions-by-sayedadi-vicz | Intuition\njavascript []\n/**\n * @param {number[]} nums1\n * @param {number[]} nums2\n * @param {number} k\n * @return {number}\n */\nvar numberOfPairs = funct | sayedadinan | NORMAL | 2024-05-30T04:39:06.847942+00:00 | 2024-05-30T04:40:33.614808+00:00 | 352 | false | # Intuition\n```javascript []\n/**\n * @param {number[]} nums1\n * @param {number[]} nums2\n * @param {number} k\n * @return {number}\n */\nvar numberOfPairs = function(nums1, nums2, k) {\n let count=0;\n for(let i=0;i<nums1.length;i++){\n for(let j=0;j<nums2.length;j++){\n if(nums1[i]%(nums2[j]... | 2 | 0 | ['Java', 'Go', 'Python3', 'JavaScript', 'C#', 'Dart'] | 0 |
find-the-number-of-good-pairs-i | Simple java solution | simple-java-solution-by-ankitbi1713-duil | \n# Code\n\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int goodpair=0;\n for(int i=0;i<nums1.length;i++){ | ANKITBI1713 | NORMAL | 2024-05-29T01:26:36.762464+00:00 | 2024-05-29T01:26:36.762483+00:00 | 249 | false | \n# Code\n```\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int goodpair=0;\n for(int i=0;i<nums1.length;i++){\n for(int j=0;j<nums2.length;j++){\n if(nums1[i]%(nums2[j]*k)==0){\n goodpair++;\n }\n ... | 2 | 0 | ['Array', 'Hash Table', 'C', 'C++', 'Java'] | 2 |
find-the-number-of-good-pairs-i | Easy Solution in C++ || Optimal Solution | easy-solution-in-c-optimal-solution-by-k-e1i2 | \n Describe your first thoughts on how to solve this problem. \n\n\n\n# Code\n\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int> | Kalyan1900 | NORMAL | 2024-05-26T08:46:15.938149+00:00 | 2024-05-26T08:46:15.938176+00:00 | 147 | false | \n<!-- Describe your first thoughts on how to solve this problem. -->\n\n\n\n# Code\n```\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int count = 0;\n int i = 0, j = 0;\n while(i<nums1.size() && j<nums2.size()){\n if(nums1[i] % (num... | 2 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | C++ Multiple approaches | c-multiple-approaches-by-offline-keshav-rbza | To address the problem of counting pairs of integers (nums1[i], nums2[j]) where nums1[i] is divisible by nums2[j]*k, we explore two distinct approaches: a brute | offline-keshav | NORMAL | 2024-05-26T04:09:36.889874+00:00 | 2024-05-26T04:09:36.889897+00:00 | 99 | false | To address the problem of counting pairs of integers `(nums1[i], nums2[j])` where `nums1[i]` is divisible by `nums2[j]*k`, we explore two distinct approaches: a brute force method and an optimized strategy employing sorting and two pointers.\n\n# Brute Force Approach\n\n## Algorithm:\n1. **Initialize Counter**: Set `co... | 2 | 1 | ['Divide and Conquer', 'Ordered Map', 'C++'] | 2 |
find-the-number-of-good-pairs-i | ✅ Java Solution | java-solution-by-harsh__005-45s5 | CODE\nJava []\npublic int numberOfPairs(int[] nums1, int[] nums2, int k) {\n\tint n = nums1.length, m = nums2.length;\n\tint ct = 0;\n\tfor(int i=0; i<n; i++){\ | Harsh__005 | NORMAL | 2024-05-26T04:02:52.706905+00:00 | 2024-05-26T04:02:52.706933+00:00 | 555 | false | ## **CODE**\n```Java []\npublic int numberOfPairs(int[] nums1, int[] nums2, int k) {\n\tint n = nums1.length, m = nums2.length;\n\tint ct = 0;\n\tfor(int i=0; i<n; i++){\n\t\tfor(int j=0; j<m; j++) {\n\t\t\tif((nums1[i] % (nums2[j]*k)) == 0) ct++;\n\t\t}\n\t}\n\treturn ct;\n}\n``` | 2 | 0 | ['Java'] | 2 |
find-the-number-of-good-pairs-i | Hash Map || JavaScript || O(n*m) | hash-map-javascript-onm-by-poetryofcode-wrzp | Code | PoetryOfCode | NORMAL | 2025-03-31T00:17:31.663405+00:00 | 2025-03-31T00:17:31.663405+00:00 | 34 | false |
# Code
```javascript []
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @param {number} k
* @return {number}
*/
var numberOfPairs = function(nums1, nums2, k) {
const freq = new Map();
for (const num of nums2) {
const key = num * k;
freq.set(key, (freq.get(key) || 0) + 1);
}
... | 1 | 0 | ['JavaScript'] | 0 |
find-the-number-of-good-pairs-i | 0ms + 100% beats C++ | 0ms-100-beats-c-by-maaz_ali27-zohk | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Maaz_Ali27 | NORMAL | 2025-03-26T11:19:24.193230+00:00 | 2025-03-26T11:19:24.193230+00:00 | 38 | 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
`... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | EASY C# SOLUTION 100% | easy-c-solution-100-by-tequilasunset69-j0ws | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | TequilaSunset69 | NORMAL | 2025-03-16T20:33:15.858163+00:00 | 2025-03-16T20:33:15.858163+00:00 | 6 | 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
`... | 1 | 0 | ['C#'] | 0 |
find-the-number-of-good-pairs-i | Solution for Dart | solution-for-dart-by-bazil663-q974 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Bazil663 | NORMAL | 2025-03-06T07:12:15.511716+00:00 | 2025-03-06T07:12:15.511716+00:00 | 20 | false | # Intuition
<!-- The Simple way to do this. -->
# Approach
<!-- Straight forward and simple -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```dart []
class Solution {
int numberOfPairs(List... | 1 | 0 | ['Dart'] | 2 |
find-the-number-of-good-pairs-i | ⚡100.00% ⚡ || ✅SUPER SIMPLE CODE 💌 || Easy to understand 🍨 || C++ | 10000-super-simple-code-easy-to-understa-8rzt | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Thakur_Avaneesh | NORMAL | 2025-03-05T17:17:35.724547+00:00 | 2025-03-05T17:17:35.724547+00:00 | 70 | 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
`... | 1 | 0 | ['Array', 'Counting', 'C++'] | 0 |
find-the-number-of-good-pairs-i | beats 100% 🦅 | beats-100-by-asmit_kandwal-1aq3 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Asmit_Kandwal | NORMAL | 2025-02-06T15:32:25.661060+00:00 | 2025-02-06T15:32:25.661060+00:00 | 156 | 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
`... | 1 | 0 | ['C++'] | 1 |
find-the-number-of-good-pairs-i | EASY GENERAL SOLUTION | easy-general-solution-by-nidhibaratam200-d846 | Code | nidhibaratam2005 | NORMAL | 2025-02-04T06:17:01.496602+00:00 | 2025-02-04T06:17:01.496602+00:00 | 138 | false |
# Code
```java []
class Solution {
public int numberOfPairs(int[] n1, int[] n2, int k)
{
int n=n1.length;
int m=n2.length;
int count=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(n1[i]%(n2[j]*k)==0)
coun... | 1 | 0 | ['Array', 'Hash Table', 'Java'] | 0 |
find-the-number-of-good-pairs-i | 1ms 100% beat in java very easiest code 😊. | 1ms-100-beat-in-java-very-easiest-code-b-jd6e | Code | Galani_jenis | NORMAL | 2025-01-09T09:22:24.926948+00:00 | 2025-01-09T09:22:24.926948+00:00 | 114 | false | 
# Code
```java []
class Solution {
public int numberOfPairs(int[] nums1, int[] nums2, int k) {
int ans = 0;
for (int i = 0; i < nums... | 1 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | Swift solution | swift-solution-by-shpwrckd-cj21 | Code | Shpwrckd | NORMAL | 2025-01-09T08:26:23.831005+00:00 | 2025-01-09T08:26:23.831005+00:00 | 26 | false |
# Code
```swift []
class Solution {
func numberOfPairs(_ nums1: [Int], _ nums2: [Int], _ k: Int) -> Int {
var c = 0
for i in 0..<nums1.count{
for j in 0..<nums2.count{
if nums1[i] % (nums2[j]*k) == 0{
c += 1
}
}
... | 1 | 0 | ['Swift'] | 0 |
find-the-number-of-good-pairs-i | Beginner Friendly | beginner-friendly-by-cs1a_2310397-91un | Easiest Approach100%Complexity
Time complexity:O(n^2)
Space complexity:O(1)
Code | cs1a_2310397 | NORMAL | 2025-01-06T09:56:19.103436+00:00 | 2025-01-06T09:56:19.103436+00:00 | 44 | false |
<!-- Describe your first thoughts on how to solve this problem. -->
# Easiest Approach
# 100%
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:O(n^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$... | 1 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | Simple solution 100% beat | simple-solution-100-beat-by-cs_220164010-h7n0 | Complexity
Time complexity:O(n*n)
Space complexity:O(1)
Code | CS_2201640100153 | NORMAL | 2024-12-28T15:31:27.490677+00:00 | 2024-12-28T15:31:27.490677+00:00 | 136 | false |
# Complexity
- Time complexity:O(n*n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```python3 []
class Solution:
def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:
for i in range(len(nu... | 1 | 0 | ['Array', 'Hash Table', 'Python3'] | 0 |
find-the-number-of-good-pairs-i | C++ || Precomputed divisors using hash map | c-precomputed-divisors-using-hash-map-by-3oti | ApproachThis optimized approach will be faster, especially for larger arrays with duplicate values in nums2.
Precomputation:
Precompute all possible divisors n | sajeeshpayolam | NORMAL | 2024-12-23T16:32:42.776793+00:00 | 2024-12-23T16:32:42.776793+00:00 | 160 | false | # Approach
This optimized approach will be faster, especially for larger arrays with duplicate values in `nums2`.
1. **Precomputation:**
Precompute all possible divisors `nums2[j] * k` and their frequencies.
2. **Efficient Divisibility Check:**
For each element in `nums1`, iterate through the precomputed divisors, ch... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | C++ Solution 💻| Easy 😊| Explained🤔 | 100% Faster 🚀 | c-solution-easy-explained-100-faster-by-nnjic | Find the Number of Good Pairs\n\n\n## Intuition\nTo determine the number of "good pairs," the solution compares all possible pairs (i, j) of the arrays nums1 an | amols_15 | NORMAL | 2024-11-20T15:10:57.814731+00:00 | 2024-11-20T15:10:57.814793+00:00 | 78 | false | # Find the Number of Good Pairs\n\n\n## Intuition\nTo determine the number of "good pairs," the solution compares all possible pairs `(i, j)` of the arrays `nums1` and `nums2` and checks if the condition `nums1[i] % (nums2[j] * k) == 0` is satisfied.\n\n## Approach\n- Iterate through each element in `nums1` and `nums2`... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | Simple Python Solution Beats 91.59% | simple-python-solution-beats-9159-by-eth-1k1j | 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 | ethan17225 | NORMAL | 2024-11-04T19:25:37.669085+00:00 | 2024-11-04T19:25:37.669128+00:00 | 18 | 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:\nO(mxn)\n- Space complexity:\nO(1)\n# Code\n```python3 []\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: Lis... | 1 | 0 | ['Python3'] | 0 |
find-the-number-of-good-pairs-i | Easy JS solution | easy-js-solution-by-joelll-533n | 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 | Joelll | NORMAL | 2024-09-27T04:21:45.541985+00:00 | 2024-09-27T04:21:45.542009+00:00 | 36 | 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 | ['JavaScript'] | 0 |
find-the-number-of-good-pairs-i | ez soln. for beginners | beats 100% |please upvote | ez-soln-for-beginners-beats-100-please-u-m4xx | \n\n# Code\njava []\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int cnt=0;\n for(int i=0;i<nums1.length;i | Lil_kidZ | NORMAL | 2024-09-26T17:23:51.248249+00:00 | 2024-09-26T17:23:51.248293+00:00 | 73 | false | \n\n# Code\n```java []\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int cnt=0;\n for(int i=0;i<nums1.length;i++){\n for(int j=0;j<nums2.length;j++){\n if(nums1[i]%(nums2[j]*k)==0)cnt++;\n }\n }\n return cnt;\n }\... | 1 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | EASY SOLUTION|| JAVA|| | easy-solution-java-by-robinrajput2869-pbem | 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 | robinrajput2869 | NORMAL | 2024-09-15T06:19:57.343993+00:00 | 2024-09-15T06:19:57.344022+00:00 | 17 | 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 |
find-the-number-of-good-pairs-i | Neat and Clean Solution in Java 🪄🪄 | neat-and-clean-solution-in-java-by-jasne-1qc0 | \uD83D\uDCBB Code\njava []\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int n = nums1.length, m = nums2.length;\n | jasneet_aroraaa | NORMAL | 2024-08-21T16:03:38.866026+00:00 | 2024-08-21T16:03:38.866053+00:00 | 5 | false | # \uD83D\uDCBB Code\n```java []\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int n = nums1.length, m = nums2.length;\n int cnt = 0;\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < m; j++) {\n if (nums1[i] % (nums2[j] * k) == ... | 1 | 0 | ['Array', 'Java'] | 0 |
find-the-number-of-good-pairs-i | Python3 || Easy Solution😃😃 | python3-easy-solution-by-hanishb81-2rl2 | Code\n\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n count = 0\n for i in range(0, len(nums1 | hanishb81 | NORMAL | 2024-08-09T17:05:50.441172+00:00 | 2024-08-09T17:05:50.441199+00:00 | 95 | false | # Code\n```\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n count = 0\n for i in range(0, len(nums1)):\n for j in range(0, len(nums2)):\n if nums1[i] % (nums2[j]*k) == 0:\n count += 1\n return count\n``... | 1 | 0 | ['Python3'] | 1 |
find-the-number-of-good-pairs-i | C# Simple and Easy to understand | c-simple-and-easy-to-understand-by-rhaze-qhml | \npublic class Solution {\n public int NumberOfPairs(int[] nums1, int[] nums2, int k) {\n int ans=0;\n for(int i=0;i<nums1.Length;i++){\n | rhazem13 | NORMAL | 2024-08-08T10:56:32.846491+00:00 | 2024-08-08T10:56:32.846510+00:00 | 40 | false | ```\npublic class Solution {\n public int NumberOfPairs(int[] nums1, int[] nums2, int k) {\n int ans=0;\n for(int i=0;i<nums1.Length;i++){\n for(int j=0;j<nums2.Length;j++){\n if(nums1[i]%(nums2[j]*k)==0)\n ans++;\n }\n }\n return an... | 1 | 0 | [] | 0 |
find-the-number-of-good-pairs-i | Simple Approach || C++ Solution | simple-approach-c-solution-by-jeetgajera-h2jh | 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 | Jeetgajera | NORMAL | 2024-08-08T03:31:29.520350+00:00 | 2024-08-08T03:31:29.520370+00:00 | 1 | 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', 'C++'] | 0 |
find-the-number-of-good-pairs-i | ✔️✔️✔️very easy - brute force - PYTHON || C++ || JAVA⚡⚡⚡beats 99%⚡⚡⚡ | very-easy-brute-force-python-c-javabeats-s1lr | Code\nPython []\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n count = 0\n for i in range(len | anish_sule | NORMAL | 2024-07-29T07:23:43.062782+00:00 | 2024-07-29T07:23:43.062812+00:00 | 434 | false | # Code\n```Python []\nclass Solution:\n def numberOfPairs(self, nums1: List[int], nums2: List[int], k: int) -> int:\n count = 0\n for i in range(len(nums1)):\n for j in range(len(nums2)):\n if nums1[i] % (nums2[j] * k) == 0:\n count += 1\n return coun... | 1 | 0 | ['Array', 'C++', 'Java', 'Python3'] | 0 |
find-the-number-of-good-pairs-i | Simple Approach! | simple-approach-by-ankit1317-veol | Code\n\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int count=0;\n for(int i=0;i<nums1.length;i++){\n | Ankit1317 | NORMAL | 2024-07-13T07:50:58.715491+00:00 | 2024-07-13T07:50:58.715533+00:00 | 1,124 | false | # Code\n```\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int count=0;\n for(int i=0;i<nums1.length;i++){\n for(int j=0;j<nums2.length;j++){\n if(nums1[i]%(nums2[j]*k)==0)\n count++;\n }\n }\n return c... | 1 | 0 | ['Array', 'Hash Table', 'C++', 'Java'] | 1 |
find-the-number-of-good-pairs-i | Runtime 99.94% | runtime-9994-by-bekzodmirzayev-5l3a | Code\n\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int res=0; \n for(int i=0; i<nums1.length; i++){\n | bekzodmirzayev | NORMAL | 2024-06-15T13:32:44.977544+00:00 | 2024-06-15T13:32:44.977600+00:00 | 8 | false | # Code\n```\nclass Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n int res=0; \n for(int i=0; i<nums1.length; i++){\n for(int j=0; j<nums2.length; j++){\n if(nums1[i]%(nums2[j]*k)==0) res++;\n }\n }\n return res;\n }\n}\n``` | 1 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | easy swift solution | easy-swift-solution-by-sayedadinan-742a | 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 | sayedadinan | NORMAL | 2024-05-30T04:47:14.349400+00:00 | 2024-05-30T04:47:14.349429+00:00 | 142 | 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 | ['Swift'] | 0 |
find-the-number-of-good-pairs-i | Simple Approach! | simple-approach-by-jasijasu959-xwoy | 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 | jasijasu959 | NORMAL | 2024-05-29T04:40:23.378570+00:00 | 2024-05-29T04:40:23.378592+00:00 | 102 | 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 | ['Dart'] | 0 |
find-the-number-of-good-pairs-i | Time complexity 0(n) solution | time-complexity-0n-solution-by-ashita_ja-b6yn | Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem here is to reduce the time complexity from o(n2) to o(n) so taking this as | Ashita_java | NORMAL | 2024-05-28T09:28:13.445693+00:00 | 2024-05-28T09:28:13.445723+00:00 | 13 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem here is to reduce the time complexity from o(n2) to o(n) so taking this as the primary intution try to code with a single for loop\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nhere we have taken one ... | 1 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | C# Two Pointers approach 65ms && 45.2MB | c-two-pointers-approach-65ms-452mb-by-de-yu45 | Sorting the arrays and moving the pointers around according to the combination of numbers\n\n# Code\n\npublic class Solution {\n public int NumberOfPairs(int | DeyanDiulgerov | NORMAL | 2024-05-27T10:00:38.555136+00:00 | 2024-05-27T10:00:38.555155+00:00 | 75 | false | Sorting the arrays and moving the pointers around according to the combination of numbers\n\n# Code\n```\npublic class Solution {\n public int NumberOfPairs(int[] nums1, int[] nums2, int k) {\n Array.Sort(nums1);\n Array.Sort(nums2);\n int n = nums1.Length, m = nums2.Length;\n int resCoun... | 1 | 0 | ['C#'] | 0 |
find-the-number-of-good-pairs-i | Simple C++ | simple-c-by-deva766825_gupta-ig6m | 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 | deva766825_gupta | NORMAL | 2024-05-27T02:26:41.629948+00:00 | 2024-05-27T02:26:41.629965+00:00 | 1 | 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 |
find-the-number-of-good-pairs-i | Simple Python3 with Speed Improvement | simple-python3-with-speed-improvement-by-mynn | Intuition\n Describe your first thoughts on how to solve this problem. \nIf the element X in nums1 is not devisable by k then we can avoid extra calculation for | maminnas | NORMAL | 2024-05-27T01:12:50.327521+00:00 | 2024-05-27T01:12:50.327549+00:00 | 100 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIf the element X in nums1 is not devisable by k then we can avoid extra calculation for each member of nums2 for that element X.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nCheck divisibility by k and continue be... | 1 | 0 | ['Python3'] | 0 |
find-the-number-of-good-pairs-i | Optimized | optimized-by-vipultawde000-ac6d | Intuition\n Describe your first thoughts on how to solve this problem. \nObvious solution of Brute Force is available.\n\nRemember - \nConstraints:\n\n1 <= n, m | vipultawde000 | NORMAL | 2024-05-26T16:14:59.407006+00:00 | 2024-05-26T16:14:59.407023+00:00 | 19 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nObvious solution of Brute Force is available.\n\nRemember - \nConstraints:\n\n1 <= n, m <= 50\n1 <= nums1[i], nums2[j] <= 50\n1 <= k <= 50\n\nBruteforce max iters = 50 x 50 = 2500\n\n# Approach\nAdding an extra check that will be executed... | 1 | 0 | ['Python3'] | 0 |
find-the-number-of-good-pairs-i | CPP Solution Easy and Effective | cpp-solution-easy-and-effective-by-mriga-ck19 | Intuition\nSimple Brute force Used\n# Approach\n Describe your approach to solving the problem. \n1. Initialize a Counter : Start by initializing a counter cnt | Mrigaank | NORMAL | 2024-05-26T13:12:50.614093+00:00 | 2024-05-26T13:12:50.614112+00:00 | 41 | false | # Intuition\nSimple Brute force Used\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Initialize a Counter : Start by initializing a counter cnt to zero. This will keep track of the number of valid pairs.\n2. Nested Loop through Both Arrays : Use a nested loop to iterate through every possible p... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | Easy Beginner Solution || No HashMap | easy-beginner-solution-no-hashmap-by-shi-whnt | \n# Approach\n Describe your approach to solving the problem. \nUse 2 for loops to check every possible combination.\n\n# Complexity\n- Time complexity: 0(n^2)\ | ShivamKhator | NORMAL | 2024-05-26T12:55:47.382577+00:00 | 2024-05-26T12:55:47.382607+00:00 | 76 | false | \n# Approach\n<!-- Describe your approach to solving the problem. -->\nUse 2 `for` loops to check every possible combination.\n\n# Complexity\n- Time complexity: 0(n^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: 0(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n`... | 1 | 0 | ['Array', 'C++'] | 2 |
find-the-number-of-good-pairs-i | Simple and very easy to understand solution | simple-and-very-easy-to-understand-solut-xev6 | Intuition\ncheck for every nnumber in nums1 how many nums2[i] divide it.\n\n# Approach\nsimple brute force\n\n# Complexity\n- Time complexity:\n O(n^2) \n\n- Sp | Saksham_Gulati | NORMAL | 2024-05-26T12:27:24.864838+00:00 | 2024-05-26T12:27:24.864866+00:00 | 280 | false | # Intuition\ncheck for every nnumber in nums1 how many nums2[i] divide it.\n\n# Approach\nsimple brute force\n\n# Complexity\n- Time complexity:\n $$O(n^2)$$ \n\n- Space complexity:\n$$O(1)$$ \n\n# Code\n```\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int ... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | Computing divisors (maths solution) | computing-divisors-maths-solution-by-alm-6bm0 | Intuition\n Describe your first thoughts on how to solve this problem. \nLet\'s find all divisors of an integer!\n\n# Approach\n Describe your approach to solvi | almostmonday | NORMAL | 2024-05-26T11:42:05.151141+00:00 | 2024-05-26T12:23:06.159203+00:00 | 273 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nLet\'s find all divisors of an integer!\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nIf `nums1[i]` is divisible by `k`, you need to find all divisors of `nums1[i]` in `nums2`.\n\n# Complexity\n- Time complexity:... | 1 | 0 | ['Math', 'Number Theory', 'Python', 'Python3'] | 0 |
find-the-number-of-good-pairs-i | EASY SOLUTION PYTHON | easy-solution-python-by-sakthivasan18-hhod | 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 | Sakthivasan18 | NORMAL | 2024-05-26T07:25:40.560494+00:00 | 2024-05-26T07:25:40.560519+00:00 | 13 | 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 | ['Python3'] | 0 |
find-the-number-of-good-pairs-i | Simplest Brute Force Solution Java || Count Number of Pairs | simplest-brute-force-solution-java-count-vsyx | 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 | tusharyadav11 | NORMAL | 2024-05-26T06:53:20.015948+00:00 | 2024-05-26T06:53:20.015966+00:00 | 218 | 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 |
find-the-number-of-good-pairs-i | ✔️✔️100% Faster JavaScript Solution || Optimized Approach ✌️✌️ | 100-faster-javascript-solution-optimized-icr9 | Intuition\n Describe your first thoughts on how to solve this problem. \nFor each number num in nums1 we just need to find how many factor of num/k is present i | Boolean_Autocrats | NORMAL | 2024-05-26T05:55:57.777010+00:00 | 2024-05-26T05:55:57.777027+00:00 | 232 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFor each number num in nums1 we just need to find how many factor of num/k is present in nums2 and sum of all these value will be our answer.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. First I will store freq... | 1 | 0 | ['JavaScript'] | 0 |
find-the-number-of-good-pairs-i | ✅ Easy C++ Solution | easy-c-solution-by-moheat-wfqd | Code\n\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int n = nums1.size();\n int m = nums2. | moheat | NORMAL | 2024-05-26T05:36:56.381770+00:00 | 2024-05-26T05:36:56.381788+00:00 | 191 | false | # Code\n```\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int n = nums1.size();\n int m = nums2.size();\n int ans = 0;\n\n for(int i=0;i<n;i++)\n {\n int temp = nums1[i];\n for(int j=0;j<m;j++)\n {... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | [ Python ] ✅✅ Simple Python Solution | 100 % Faster🥳✌👍 | python-simple-python-solution-100-faster-hsd7 | If You like the Solution, Please UpVote! \uD83D\uDD3C\uD83D\uDE4F\n# Runtime: 54 ms, faster than 100.00% of Python3 online submissions for Find the Number of Go | ashok_kumar_meghvanshi | NORMAL | 2024-05-26T04:57:53.057388+00:00 | 2024-05-26T04:57:53.057412+00:00 | 232 | false | # If You like the Solution, Please UpVote! \uD83D\uDD3C\uD83D\uDE4F\n# Runtime: 54 ms, faster than 100.00% of Python3 online submissions for Find the Number of Good Pairs I.\n# Memory Usage: 16.6 MB, less than 100.00% of Python3 online submissions for Find the Number of Good Pairs I.\n where nums1[i] is divisible by nums2[j]*k, we can use a straightforward nested loop approach. For each e | leet1101 | NORMAL | 2024-05-26T04:11:44.573127+00:00 | 2024-05-26T04:11:44.573145+00:00 | 219 | false | # Intuition\nTo determine the number of good pairs `(i, j)` where `nums1[i]` is divisible by `nums2[j]*k`, we can use a straightforward nested loop approach. For each element in `nums2`, calculate `nums2[j]*k` and then check all elements in `nums1` to see if they are divisible by this value.\n\n# Approach\n1. **Initial... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | Java Simple Nive Solution | 26/5/2024 | java-simple-nive-solution-2652024-by-shr-63tf | Complexity\n- Time complexity:O(n^2)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# Ot | Shree_Govind_Jee | NORMAL | 2024-05-26T04:11:35.677519+00:00 | 2024-05-26T04:11:35.677542+00:00 | 88 | false | # Complexity\n- Time complexity:$$O(n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Other Version (SIMILAR QUESTION)\nhttps://leetcode.com/problems/find-the-number-of-good-pairs-ii/solutions/5208996/java-clean-solu... | 1 | 0 | ['Array', 'Math', 'Matrix', 'Java'] | 2 |
find-the-number-of-good-pairs-i | JAVA SOLUTION || 1MS SOLUTION || 100 % FASTER | java-solution-1ms-solution-100-faster-by-n8c8 | 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 | viper_01 | NORMAL | 2024-05-26T04:08:29.057570+00:00 | 2024-05-26T04:08:29.057641+00:00 | 279 | 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: O(N\xB2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.... | 1 | 0 | ['Java'] | 2 |
find-the-number-of-good-pairs-i | ✨⚡️✨ Fastest Solution ✨⚡️✨ | fastest-solution-by-crossmind-v920 | \n\n# Code\n\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int ans = 0;\n \n for (in | CrossMind | NORMAL | 2024-05-26T04:07:30.852706+00:00 | 2024-05-26T04:07:30.852735+00:00 | 197 | false | \n\n# Code\n```\nclass Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n int ans = 0;\n \n for (int i = 0; i < nums1.size(); i++) {\n for (int j = 0; j < nums2.size(); j++) {\n if (nums1[i] % (nums2[j] * k) == 0) {\n ... | 1 | 0 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | C++ || MAX LIMIT EASY BEATS 100% | c-max-limit-easy-beats-100-by-abhishek64-mds4 | 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 | Abhishek6487209 | NORMAL | 2024-05-26T04:05:54.537764+00:00 | 2024-05-26T04:06:11.912176+00:00 | 185 | 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++'] | 2 |
find-the-number-of-good-pairs-i | Simple Python Solution | simple-python-solution-by-ascending-vo9j | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | ascending | NORMAL | 2025-04-05T15:47:29.556762+00:00 | 2025-04-05T15:47:29.556762+00:00 | 1 | 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 |
find-the-number-of-good-pairs-i | Simple Swift Solution | simple-swift-solution-by-felisviridis-7vcz | Code | Felisviridis | NORMAL | 2025-04-03T08:53:10.423394+00:00 | 2025-04-03T08:53:10.423394+00:00 | 3 | false | 
# Code
```swift []
class Solution {
func numberOfPairs(_ nums1: [Int], _ nums2: [Int], _ k: Int) -> Int {
var count = 0
for i in nums1 {
for... | 0 | 0 | ['Array', 'Swift'] | 0 |
find-the-number-of-good-pairs-i | JAVA Solution | java-solution-by-yayjyvijaj-hevs | IntuitionApproachComplexity
Time complexity:
o(n2)
Space complexity:
o(1)Code | YaYJYVIJAj | NORMAL | 2025-04-02T10:48:43.998443+00:00 | 2025-04-02T10:48:43.998443+00:00 | 2 | 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(n2)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
o(1... | 0 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | easy and best solution in c++ | easy-and-best-solution-in-c-by-ashish754-arox | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Ashish754937 | NORMAL | 2025-04-01T04:59:12.673871+00:00 | 2025-04-01T04:59:12.673871+00:00 | 3 | 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 | ['C++'] | 0 |
find-the-number-of-good-pairs-i | Simple || Java ||easy to understand || Beats 100%✅ | simple-java-easy-to-understand-beats-100-ldk6 | Proof👇🏻https://leetcode.com/problems/find-the-number-of-good-pairs-i/submissions/1590830700Complexity
Time complexity:O(n)
Space complexity:O(1)
Code | SamirSyntax | NORMAL | 2025-03-30T07:05:12.374032+00:00 | 2025-03-30T07:05:12.374032+00:00 | 3 | false | # Proof👇🏻
https://leetcode.com/problems/find-the-number-of-good-pairs-i/submissions/1590830700
# Complexity
- Time complexity:O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```java []
class Solution {
public int n... | 0 | 0 | ['Java'] | 0 |
find-the-number-of-good-pairs-i | basic and best code | basic-and-best-code-by-nikhilgupta932-3aoe | Code | Nikhilgupta932 | NORMAL | 2025-03-29T21:59:36.442796+00:00 | 2025-03-29T21:59:36.442796+00:00 | 1 | false |
# Code
```cpp []
class Solution {
public:
int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {
int n=nums1.size();
int m=nums2.size();
int count=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(nums1[i]%(nums2[j]*k)==0)
coun... | 0 | 0 | ['C++'] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.