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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element-appearing-more-than-25-in-sorted-array | easy c++ code🔥🔥💯 | easy-c-code-by-aboelanwar7-n4do | 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 | Aboelanwar7 | NORMAL | 2023-12-11T00:16:01.028080+00:00 | 2023-12-11T00:16:01.028099+00:00 | 362 | 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 |
element-appearing-more-than-25-in-sorted-array | Brute force and Optimised Both Solution (Beats 100%) | brute-force-and-optimised-both-solution-1pjt9 | 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 | Yashrajsingh282 | NORMAL | 2023-10-29T15:06:05.222539+00:00 | 2023-10-29T15:06:05.222565+00:00 | 112 | 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'] | 0 |
element-appearing-more-than-25-in-sorted-array | ✅✅C++ Easy solution || Simple || No extra space | c-easy-solution-simple-no-extra-space-by-whpd | EXPLANATION\nHere we iterated through the given arr vector and checked if any number\'s frequency is greater than or equal to n/4+1. \nSo we return that number. | praegag | NORMAL | 2023-09-01T06:17:32.180973+00:00 | 2023-09-01T06:18:13.456196+00:00 | 152 | false | # EXPLANATION\nHere we iterated through the given **arr** vector and checked if any number\'s frequency is greater than or equal to **n/4+1**. \nSo we return that number.\n# SOLUTION\n```\nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n int n=arr.size();\n int c=1,num=arr[0];\n... | 2 | 0 | ['Array', 'C++'] | 1 |
element-appearing-more-than-25-in-sorted-array | Beginner friendly approach in Java | beginner-friendly-approach-in-java-by-he-940v | 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 | Hemuuu | NORMAL | 2023-06-22T07:50:03.032012+00:00 | 2023-06-22T07:50:03.032041+00:00 | 83 | 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'] | 0 |
element-appearing-more-than-25-in-sorted-array | Beginner friendly approach in java | beginner-friendly-approach-in-java-by-st-kx7r | Intuition\n Describe your first thoughts on how to solve this problem. \nI thought of calculating freaquency of all elements ,then divide each element\'s freque | starryvaibh | NORMAL | 2023-01-26T16:20:37.550699+00:00 | 2023-01-26T16:20:37.550760+00:00 | 503 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nI thought of calculating freaquency of all elements ,then divide each element\'s frequency with length of array. If the percentage is >0.25 , then simply return that element.\n\n# Approach\n<!-- Describe your approach to solving the probl... | 2 | 0 | ['Hash Table', 'Hash Function', 'Java'] | 0 |
element-appearing-more-than-25-in-sorted-array | Simple Approach Python3 Easy | simple-approach-python3-easy-by-krish221-xpr2 | Intuition\n The question is to find the element that has a frequency greater than 25% and there exists only one such element. So it should be the element with g | krish2213 | NORMAL | 2023-01-19T14:19:45.546318+00:00 | 2023-01-19T14:19:45.546375+00:00 | 107 | false | # Intuition\n<!-- The question is to find the element that has a frequency greater than 25% and there exists only one such element. So it should be the element with greater frequency in simple elements. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- ... | 2 | 0 | ['Python3'] | 1 |
element-appearing-more-than-25-in-sorted-array | Sliding Window, easy to follow and 95%+ O(n) | sliding-window-easy-to-follow-and-95-on-76kg6 | Approach\nSliding Window\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\n/**\n * @param {number[]} arr\n * @return {number}\ | hanbi58 | NORMAL | 2022-11-27T21:58:29.406054+00:00 | 2022-11-27T21:58:29.406079+00:00 | 235 | false | # Approach\nSliding Window\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\n/**\n * @param {number[]} arr\n * @return {number}\n */\nvar findSpecialInteger = function(arr) {\n for(let f=0,s=0;f<arr.length;f++){\n if(arr[s]===arr[f] && f-s+1> arr.length*0.25){return arr[s]... | 2 | 0 | ['JavaScript'] | 1 |
element-appearing-more-than-25-in-sorted-array | easy c++ solution just using map and returning ans 😎😎😎 | easy-c-solution-just-using-map-and-retur-g311 | 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 | youdontknow001 | NORMAL | 2022-11-26T13:06:47.660086+00:00 | 2022-11-26T13:06:47.660117+00:00 | 981 | 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 | 1 | ['C++'] | 0 |
element-appearing-more-than-25-in-sorted-array | c++ | easy | short | c-easy-short-by-venomhighs7-pp9y | \n# Code\n\nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n int sz = arr.size();\n vector<int> candidates = {arr[sz/4] | venomhighs7 | NORMAL | 2022-10-09T12:09:44.224730+00:00 | 2022-10-09T12:09:44.224756+00:00 | 780 | false | \n# Code\n```\nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n int sz = arr.size();\n vector<int> candidates = {arr[sz/4], arr[sz/2], arr[sz*3/4]};\n for (auto cand : candidates) {\n auto st = lower_bound(arr.begin(), arr.end(), cand);\n auto ed = u... | 2 | 0 | ['C++'] | 0 |
element-appearing-more-than-25-in-sorted-array | JS very easy solution | js-very-easy-solution-by-kunkka1996-ypok | \nvar findSpecialInteger = function(arr) {\n if (arr.length === 1) return arr[0];\n let count = 1;\n for (let i = 1; i < arr.length; i++) {\n if | kunkka1996 | NORMAL | 2022-10-04T05:10:07.786592+00:00 | 2022-10-04T05:10:07.786636+00:00 | 605 | false | ```\nvar findSpecialInteger = function(arr) {\n if (arr.length === 1) return arr[0];\n let count = 1;\n for (let i = 1; i < arr.length; i++) {\n if (arr[i] === arr[i-1]) {\n count++;\n } else {\n count = 1;\n }\n if (count > arr.length/4) return arr[i];\n }\... | 2 | 0 | ['JavaScript'] | 1 |
element-appearing-more-than-25-in-sorted-array | A simple solution in Java (0 ms) | a-simple-solution-in-java-0-ms-by-toshpo-yssq | \nclass Solution {\n public int findSpecialInteger(int[] arr) {\n \n int target = arr.length / 4;\n \n for(int i = 0, count = 1; | toshpolaty | NORMAL | 2022-09-14T12:23:07.137169+00:00 | 2022-09-14T12:23:07.137213+00:00 | 339 | false | ```\nclass Solution {\n public int findSpecialInteger(int[] arr) {\n \n int target = arr.length / 4;\n \n for(int i = 0, count = 1; i < arr.length - 1; i++){\n if(arr[i] == arr[i+1]){\n count++;\n if(count > target)\n return arr[... | 2 | 0 | ['Java'] | 0 |
element-appearing-more-than-25-in-sorted-array | Short python solution uses bisect. O(logn). | short-python-solution-uses-bisect-ologn-bdvbb | The function bisect locate the insertion point for x in a to maintain sorted order.\n\nThe idea was that the special number must appear in atleast quarter of th | sezio | NORMAL | 2022-03-06T20:53:30.474055+00:00 | 2022-04-21T16:14:49.512647+00:00 | 360 | false | The function bisect locate the insertion point for x in a to maintain sorted order.\n\nThe idea was that the special number must appear in atleast quarter of the array.\n\n```\nclass Solution:\n def findSpecialInteger(self, arr: List[int]) -> int:\n n = len(arr)\n n_4th = n / 4\n candidates_loc ... | 2 | 0 | ['Python', 'Python3'] | 0 |
element-appearing-more-than-25-in-sorted-array | Easy python solution | easy-python-solution-by-vistrit-ymnp | \ndef findSpecialInteger(self, arr: List[int]) -> int:\n n=len(arr)//4\n c=Counter(arr)\n for i in arr:\n if c[i]>n:\n | vistrit | NORMAL | 2021-11-20T04:24:09.335941+00:00 | 2021-11-20T04:24:09.335974+00:00 | 211 | false | ```\ndef findSpecialInteger(self, arr: List[int]) -> int:\n n=len(arr)//4\n c=Counter(arr)\n for i in arr:\n if c[i]>n:\n return i\n``` | 2 | 0 | ['Python', 'Python3'] | 0 |
element-appearing-more-than-25-in-sorted-array | Java 100% fast with comments | java-100-fast-with-comments-by-girish13-n32d | Java Code\n\n\nclass Solution {\n public int findSpecialInteger(int[] arr) {\n \n // store the value of (1/4)th of array size\n int coun | girish13 | NORMAL | 2021-06-02T11:37:01.169899+00:00 | 2021-06-02T11:38:32.716347+00:00 | 133 | false | **Java Code**\n\n```\nclass Solution {\n public int findSpecialInteger(int[] arr) {\n \n // store the value of (1/4)th of array size\n int count = arr.length / 4;\n \n for(int i = 1; i < arr.length; i++){ \n \n // if the consecutive elements match\n... | 2 | 0 | [] | 0 |
element-appearing-more-than-25-in-sorted-array | python easy!! | python-easy-by-meganath-agng | \tclass Solution:\n\t\tdef findSpecialInteger(self, arr: List[int]) -> int:\n\t\t\ta=len(arr)//4\n\t\t\tx=list(set(arr))\n\t\t\tfor i in x:\n\t\t\t\tif arr.coun | meganath | NORMAL | 2021-05-26T11:42:32.950159+00:00 | 2021-05-26T11:42:32.950201+00:00 | 104 | false | \tclass Solution:\n\t\tdef findSpecialInteger(self, arr: List[int]) -> int:\n\t\t\ta=len(arr)//4\n\t\t\tx=list(set(arr))\n\t\t\tfor i in x:\n\t\t\t\tif arr.count(i)>a:\n\t\t\t\t\treturn(i) | 2 | 0 | [] | 1 |
element-appearing-more-than-25-in-sorted-array | Java solution faster than 100% with explanation | java-solution-faster-than-100-with-expla-nb6n | This is a pretty simple solution, we have two variables num and counter. \n\nnum is used for checking whether arr[i] is equal to the character before it, and co | nathannaveen | NORMAL | 2021-01-14T01:21:38.773893+00:00 | 2021-01-14T01:21:38.773920+00:00 | 191 | false | This is a pretty simple solution, we have two variables `num` and `counter`. \n\n`num` is used for checking whether `arr[i]` is equal to the character before it, and counter is used for telling how many characters before are equal to `arr[i]`.\n\nWhen `arr[i]` is not equal to `num` then we check whether `counter > arr.... | 2 | 0 | ['Java'] | 0 |
element-appearing-more-than-25-in-sorted-array | C++ solution | Time: O(N), Space: O(1) | c-solution-time-on-space-o1-by-vasu-the-11jf3 | \nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n \n int count=1;\n for(int i=1; i<arr.size(); i++){\n | vasu-the-sharma | NORMAL | 2021-01-01T19:03:04.604316+00:00 | 2021-01-01T19:03:04.604349+00:00 | 309 | false | ```\nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n \n int count=1;\n for(int i=1; i<arr.size(); i++){\n if(arr[i]==arr[i-1]){\n count++;\n }else{\n if(count > arr.size()/4)\n return arr[i-1];\n ... | 2 | 0 | ['C', 'C++'] | 0 |
element-appearing-more-than-25-in-sorted-array | C++ Solution || No map, no counter || 16ms | c-solution-no-map-no-counter-16ms-by-dan-0vqy | \nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n int len = arr.size();\n int times = len / 4;\n for (int i = 0 | dannymmc | NORMAL | 2020-12-26T22:29:13.781343+00:00 | 2020-12-26T22:29:13.781383+00:00 | 96 | false | ```\nclass Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n int len = arr.size();\n int times = len / 4;\n for (int i = 0; i + times < len; i++) {\n if (arr[i] == arr[i + times])\n return arr[i];\n }\n return -1;\n }\n};\n``` | 2 | 0 | [] | 0 |
element-appearing-more-than-25-in-sorted-array | Easy and Fast JavaScript | easy-and-fast-javascript-by-fl4sk-5761 | \n\nconst findSpecialInteger = arr => {\n if(arr.length == 1)\n return arr[0];\n \n const maxCount = arr.length/4;\n let count = 1;\n \n for(let i = 1 | fl4sk | NORMAL | 2020-11-25T03:58:09.906351+00:00 | 2020-11-25T03:58:09.906388+00:00 | 185 | false | ```\n\nconst findSpecialInteger = arr => {\n if(arr.length == 1)\n return arr[0];\n \n const maxCount = arr.length/4;\n let count = 1;\n \n for(let i = 1; i < arr.length; i++){\n if(arr[i] == arr[i-1]){\n count++;\n if (count > maxCount)\n return arr[i];\n }\n else\n count = 1;\... | 2 | 0 | ['JavaScript'] | 0 |
element-appearing-more-than-25-in-sorted-array | faster than 100% java submissions | faster-than-100-java-submissions-by-athi-kkxd | \nclass Solution {\n public int findSpecialInteger(int[] arr) {\n int len = arr.length;\n len = len/4;\n int count = 0;\n int min | athirasabu | NORMAL | 2020-09-28T13:59:28.709356+00:00 | 2020-09-28T13:59:28.709388+00:00 | 66 | false | ```\nclass Solution {\n public int findSpecialInteger(int[] arr) {\n int len = arr.length;\n len = len/4;\n int count = 0;\n int min = arr[0];\n for(int i = 0 ; i < arr.length ; ){\n while(i < arr.length && min == arr[i] && count <= len){\n i++; \n ... | 2 | 0 | [] | 0 |
element-appearing-more-than-25-in-sorted-array | Python one line solution | python-one-line-solution-by-yixizhou-hkca | \nclass Solution:\n def findSpecialInteger(self, arr: List[int]) -> int:\n return [x for x in arr if arr.count(x) > len(arr)/4][0]\n | yixizhou | NORMAL | 2020-08-31T19:17:50.785444+00:00 | 2020-08-31T19:17:50.785489+00:00 | 114 | false | ```\nclass Solution:\n def findSpecialInteger(self, arr: List[int]) -> int:\n return [x for x in arr if arr.count(x) > len(arr)/4][0]\n``` | 2 | 0 | [] | 0 |
element-appearing-more-than-25-in-sorted-array | Java Solution 100% in both space and time | java-solution-100-in-both-space-and-time-e8nj | \'\'\'\nclass Solution {\n public int findSpecialInteger(int[] arr) \n {\n int count=1;\n for(int i=0;i(int)(arr.length/4))\n | adarsh_goswami | NORMAL | 2020-04-17T13:02:56.713264+00:00 | 2020-04-17T13:02:56.713317+00:00 | 125 | false | \'\'\'\nclass Solution {\n public int findSpecialInteger(int[] arr) \n {\n int count=1;\n for(int i=0;i<arr.length-1;i++)\n {\n if(arr[i]==arr[i+1]) \n count++;\n else\n count=1;\n if(count>(int)(arr.length/4))\n ... | 2 | 0 | [] | 1 |
maximize-the-minimum-game-score | C++ Binary Search | c-binary-search-by-bramar2-81yq | Approach
Binary search from 1 to 1e18.
Loop through the points and add up the needed operations.
You can't just stay at one index and keep adding, you HAVE to m | bramar2 | NORMAL | 2025-02-09T03:40:09.274666+00:00 | 2025-02-10T09:47:06.975206+00:00 | 1,693 | false | # Approach
- Binary search from 1 to 1e18.
- Loop through the points and add up the needed operations.
- You can't just stay at one index and keep adding, you HAVE to move. So, you move between $i$ and $i + 1$ (because you know $i - 1$ has already been processed which means it is greater than val). In this case, you wi... | 14 | 0 | ['C++'] | 5 |
maximize-the-minimum-game-score | Binary Search | Short Code | Beginner Friendly | Example Walkthrough | binary-search-beginner-friendly-example-xp33j | Intuition
🎯 Key Observation:
To maximize the minimum value in the gameScore array after at most m moves, we must ensure every game’s score is raised to at least | shubham6762 | NORMAL | 2025-02-09T04:49:44.201454+00:00 | 2025-02-09T06:20:29.116598+00:00 | 820 | false |
## Intuition
- **🎯 Key Observation:**
To maximize the minimum value in the **gameScore** array after at most **m** moves, we must ensure every game’s score is raised to at least a target value **v**.
- For each game with point value **p**, we need at least ⌈**v/p**⌉ moves to raise its score to **v**.
- **... | 13 | 2 | ['Binary Search', 'Python', 'C++', 'Java', 'JavaScript'] | 1 |
maximize-the-minimum-game-score | [Java/C++/Python] Greedy + Binary Search | javacpython-greedy-binary-search-by-lee2-8b3m | [Java/C++/Python] Greedy + Binary SearchExplanationcheck function will check the steps necessay to make game score to target.
If gameScore[i] doesn't reach the | lee215 | NORMAL | 2025-02-10T07:30:50.236815+00:00 | 2025-02-10T07:30:50.236815+00:00 | 799 | false | [Java/C++/Python] Greedy + Binary Search
----------------------------------------------
# **Explanation**
`check` function will check the steps necessay to make game score to `target`.
If `gameScore[i]` doesn't reach the `target`,
we will move greedily by +1 then -1.
`k` is the number of move we reach at `A[i]`,
each... | 6 | 0 | ['Binary Search', 'Greedy', 'Python', 'C++', 'Java', 'Python3'] | 3 |
maximize-the-minimum-game-score | [Python] Binary Search | python-binary-search-by-awice-v98w | Binary search for the answer. You have some req[] representing how many times you need to visit each cell i. Notice you need to visit every cell at least once | awice | NORMAL | 2025-02-09T05:49:28.616969+00:00 | 2025-02-09T05:49:28.616969+00:00 | 495 | false | Binary search for the answer. You have some `req[]` representing how many times you need to visit each cell `i`. Notice you need to visit every cell at least once.
Now consider at some time you are standing to the left of index `i`. You want to visit cell `i` `req[i]` times, so you enter (1) and then go to i+1 and ... | 6 | 0 | ['Python3'] | 0 |
maximize-the-minimum-game-score | O(nlogn) || Binary Search + Greedy || Simple || Must Check | onlogn-binary-search-greedy-simple-must-asbuw | Complexity
Time complexity:
O(n.logn)
Space complexity:
O(n)Code | Priyanshu_pandey15 | NORMAL | 2025-02-14T10:50:24.016814+00:00 | 2025-02-14T10:50:24.016814+00:00 | 88 | false |
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(n.logn)$$
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
$$O(n)$$
# Code
```java []
class Solution {
static public long maxScore(int[] points, int m) {
boolean res = false;
long ma... | 3 | 0 | ['Binary Search', 'Greedy'] | 0 |
maximize-the-minimum-game-score | C++ | Binary Search | Greedy | Solution with explanation | c-binary-search-greedy-solution-with-exp-94aa | ref: https://www.zerotoexpert.blog/p/weekly-contest-436SolutionIn this problem, we should find the maximum of minimum possible value after, at most, m moves. In | a_ck | NORMAL | 2025-02-09T08:38:07.006918+00:00 | 2025-02-09T08:38:07.006918+00:00 | 250 | false | ref: https://www.zerotoexpert.blog/p/weekly-contest-436
# Solution
In this problem, we should find the maximum of minimum possible value after, at most, m moves. In this problem, if you can make all points to K within m moves, then you can say that all points are over K-1, K-2, etc. So, we can simply check if random X... | 3 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Simple Binary Search: O(n*60) | simple-binary-search-on60-by-tunt6-b7iz | IntuitionMaximize / minimize -> BSApproachUnderstanding the problem:We need to maximize the value while ensuring the total moves don’t exceed m.
The answer lies | tunt6 | NORMAL | 2025-02-09T05:58:24.551098+00:00 | 2025-02-09T10:19:56.145378+00:00 | 276 | false | # Intuition
Maximize / minimize -> BS
# Approach
## Understanding the problem:
We need to maximize the value while ensuring the total moves don’t exceed m.
The answer lies between 1 and Long.MAX_VALUE, so we can use Binary Search (BS) to efficiently find the best possible value.
## Binary Search Implementation:
1. ... | 3 | 0 | ['C++', 'Java'] | 1 |
maximize-the-minimum-game-score | EASY JAVA SOLUTION USING BINARY SEARCH {PLZ UPVOTE ME GUYS} | easy-java-solution-using-binary-search-p-edh6 | IntuitionThe problem requires us to maximize the score while ensuring that the total operations do not exceed a given limit, m. Since increasing the score monot | TOURIST15789 | NORMAL | 2025-02-09T04:38:21.711691+00:00 | 2025-02-09T04:38:21.711691+00:00 | 256 | false | # Intuition
The problem requires us to maximize the score while ensuring that the total operations do not exceed a given limit, m. Since increasing the score monotonically requires more operations, we can leverage binary search to efficiently determine the maximum achievable score.
# Approach
Binary Search on Answer:
... | 3 | 1 | ['Binary Search', 'Java'] | 2 |
maximize-the-minimum-game-score | Python - Binary search | python-binary-search-by-wanderingcicada-7xay | IntuitionGuess and checkApproachHow do we know if a guess is possible? Try to set every score >= to your guess. In order to increase your score, you must move t | wanderingCicada | NORMAL | 2025-02-09T04:29:09.282086+00:00 | 2025-02-09T04:29:09.282086+00:00 | 192 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Guess and check
# Approach
<!-- Describe your approach to solving the problem. -->
How do we know if a guess is possible? Try to set every score >= to your guess. In order to increase your score, you must move to the next index and back. Y... | 3 | 0 | ['Python3'] | 1 |
maximize-the-minimum-game-score | only binary search c++ | only-binary-search-c-by-shivanshu0287-uuz3 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | shivanshu0287 | NORMAL | 2025-02-09T04:25:58.214451+00:00 | 2025-02-09T04:25:58.214451+00:00 | 132 | 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
`... | 2 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | easy cpp solution | easy-cpp-solution-by-tourist15789-gbzh | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | TOURIST15789 | NORMAL | 2025-02-09T04:14:28.316112+00:00 | 2025-02-09T04:14:28.316112+00:00 | 378 | 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
`... | 2 | 0 | ['C++'] | 3 |
maximize-the-minimum-game-score | C++ | Binary Search + Greedy | c-binary-search-greedy-by-kena7-ht1a | Code | kenA7 | NORMAL | 2025-02-20T07:05:34.252907+00:00 | 2025-02-20T07:05:34.252907+00:00 | 21 | false |
# Code
```cpp []
class Solution {
public:
#define ll long long
bool possible(ll minS, int m, vector<int>& p)
{
int n=p.size();
vector<ll>count(n,0);
for(int i=0;i<n;i++)
{
count[i]=(minS/p[i])+(minS%p[i]!=0);
}
count[0]--;
m--;
int... | 1 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | 💥 Beats 100% on runtime [EXPLAINED] | beats-100-on-runtime-explained-by-r9n-xiz3 | IntuitionMaximize the minimum score we can achieve after making at most m moves. To do this, we need to find the best possible score by trying different values | r9n | NORMAL | 2025-02-15T04:43:28.072591+00:00 | 2025-02-15T04:43:28.072591+00:00 | 6 | false | # Intuition
Maximize the minimum score we can achieve after making at most m moves. To do this, we need to find the best possible score by trying different values and checking whether it's achievable within the m moves. We can utilize binary search to efficiently explore the range of possible scores and adjust the scor... | 1 | 0 | ['Binary Search', 'Greedy', 'Rust'] | 0 |
maximize-the-minimum-game-score | Test | test-by-fuckleetcode_bringolduiback-0j31 | test | fuckleetcode_BringOldUIBack | NORMAL | 2025-02-13T12:39:58.119046+00:00 | 2025-02-13T12:42:10.455708+00:00 | 27 | false | test | 1 | 0 | ['Python3'] | 0 |
maximize-the-minimum-game-score | Binary search on answer | binary-search-on-answer-by-vikas_dor-gwjt | Intuitionif X is the minimum in the game score array, then we need to make sure everyone should have atleast this valueThen we can say if we can acheive this wi | vikas_dor | NORMAL | 2025-02-11T19:13:20.939053+00:00 | 2025-02-11T19:13:20.939053+00:00 | 63 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
if X is the minimum in the game score array, then we need to make sure everyone should have atleast this value
Then we can say if we can acheive this with m moves
given a score, determine how many visits are required to acheive this score... | 1 | 0 | ['Binary Search', 'Greedy', 'C++'] | 0 |
maximize-the-minimum-game-score | Java Solution using BS | java-solution-using-bs-by-shaurya_malhan-9amd | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Shaurya_Malhan | NORMAL | 2025-02-10T14:30:22.697183+00:00 | 2025-02-10T14:30:22.697183+00:00 | 12 | 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 | ['Java'] | 0 |
maximize-the-minimum-game-score | Biary search on answer | biary-search-on-answer-by-user2479gs-8pbn | Code | user2479GS | NORMAL | 2025-02-09T09:49:58.854710+00:00 | 2025-02-09T09:49:58.854710+00:00 | 121 | false |
# Code
```cpp []
class Solution {
public:
bool poss(vector<long long> &p, long long mid, long long m)
{
vector<long long> v(p.size(), 0);
for (int i = 0; i < p.size(); i++)
{
if (i==p.size()-1 && v[i] >= mid)
{
continue;
}
if (m > 0)
{
v[i]+= p[i];
m--;
}
else
{
... | 1 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Easy Python Solution || Simple Explanation Given || | easy-python-solution-simple-explanation-s34kz | IntuitionThe code uses binary search to find the highest minimum game score achievable with at most m moves.For each candidate score, the helper function simula | Abhyanand_Sharma | NORMAL | 2025-02-09T04:42:14.977620+00:00 | 2025-02-09T04:42:14.977620+00:00 | 128 | false | # Intuition
The code uses binary search to find the highest minimum game score achievable with at most m moves.
For each candidate score, the helper function simulates moving through the points array, "boosting" the score when needed by spending extra moves.
It returns the maximum candidate score for which the simula... | 1 | 0 | ['Binary Search', 'Dynamic Programming', 'Simulation', 'Python3'] | 0 |
maximize-the-minimum-game-score | simple solution Java , beats 98%. | simple-solution-java-beats-98-by-naveen_-x8om | Just another binary search on ans type question.
greedy part is moving to and fro until we get min req value for that index.Time complexity is n*log(max(points[ | naveen_gunnam | NORMAL | 2025-03-02T02:07:14.224308+00:00 | 2025-03-02T02:07:14.224308+00:00 | 7 | false | Just another binary search on ans type question.
greedy part is moving to and fro until we get min req value for that index.
Time complexity is n*log(max(points[i])*m) =~ 10^4 * 50 .
and Space complexity O(1)
Happy Hacking :)
# Code
```java []
class Solution {
public long maxScore(int[] points, int m) {
... | 0 | 0 | ['Java'] | 0 |
maximize-the-minimum-game-score | [C++] Binary seach, short code with comments | c-binary-seach-short-code-with-comments-fyt8z | IntuitionA fixed number X can be the minimum of the gamescore array iff the minimum amount of operations required to bring every element in the game score array | andititu_ | NORMAL | 2025-02-25T22:25:28.911250+00:00 | 2025-02-25T22:25:28.911250+00:00 | 5 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
A fixed number X can be the minimum of the gamescore array iff the minimum amount of operations required to bring every element in the game score array to that X is less than m. To determine the minimum amount of operations to bring every e... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | binary search on answer approach. | binary-search-on-answer-approach-by-anur-vfti | IntuitionWe need to maximize the minimum score in the gameScore array after making at most m moves. Since each move increases a game’s score by a fixed amount ( | anurag_bandejiya | NORMAL | 2025-02-15T12:53:48.039250+00:00 | 2025-02-15T12:53:48.039250+00:00 | 14 | false | # Intuition
We need to maximize the minimum score in the gameScore array after making at most m moves. Since each move increases a game’s score by a fixed amount (the corresponding value from points), we can rephrase the problem as: "What is the highest minimum score we can guarantee across all games using at most m mo... | 0 | 0 | ['Binary Search', 'Greedy', 'C++'] | 0 |
maximize-the-minimum-game-score | Binary search | C++ | binary-search-c-by-siddharth96shukla-6h1x | Complexity
Time complexity: O(n∗log(1e15))
Code | siddharth96shukla | NORMAL | 2025-02-14T13:47:00.219619+00:00 | 2025-02-14T13:47:00.219619+00:00 | 13 | false | # Complexity
- Time complexity: $$O(n*log(1e15))$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
# Code
```cpp []
#define ll long long int
class Solution {
public:
bool chk(ll val, int m, vector<int>&A){
int n=A.size(), skip=0;
ll necessary=0, transfer=0, total=0, p;
for(int i=0;i<... | 0 | 0 | ['Binary Search', 'C++'] | 0 |
maximize-the-minimum-game-score | Maximize the Minimum Game Score | maximize-the-minimum-game-score-by-jeyap-a27k | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | jeyapragash1 | NORMAL | 2025-02-13T07:51:20.482808+00:00 | 2025-02-13T07:51:20.482808+00:00 | 12 | 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 | ['Java'] | 0 |
maximize-the-minimum-game-score | 3449. Maximize the Minimum Game Score | 3449-maximize-the-minimum-game-score-by-wyhb1 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | jeyapragash1 | NORMAL | 2025-02-13T07:33:39.082083+00:00 | 2025-02-13T07:33:39.082083+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
`... | 0 | 0 | ['Java'] | 0 |
maximize-the-minimum-game-score | Maximize the Minimum Game Score (Beats 100% ) TC:- O(N), SC:- O(1) | maximize-the-minimum-game-score-beats-10-3x20 | Complexity
Time complexity: O(Log(Max(points)))
Space complexity: O(1)
Code | Ansh1707 | NORMAL | 2025-02-12T21:17:48.397173+00:00 | 2025-02-12T21:17:48.397173+00:00 | 14 | false |
# Complexity
- Time complexity: O(Log(Max(points)))
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
```python []
class Solution(object):
def is_possible(self, target_time, points, max_moves):
moves_used = extra_... | 0 | 0 | ['Binary Search', 'Greedy', 'Python'] | 0 |
maximize-the-minimum-game-score | BS + Greedy | CPP Solution | bs-greedy-cpp-solution-by-cholebhature-mttt | Complexity
Time complexity:
O(nlog(max(points)∗m)) (i have approximated it to be 10^15 in the solution)
Space complexity:
O(1)
Code | cholebhature | NORMAL | 2025-02-12T10:18:43.483715+00:00 | 2025-02-12T10:18:43.483715+00:00 | 21 | false | # Complexity
- Time complexity:
$$O(nlog(max(points)*m))$$ (i have approximated it to be 10^15 in the solution)
- Space complexity:
$$O(1)$$
# Code
```cpp []
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
bool f(const vector<int>& points, long long m, long long x) {
... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Easy Implementation !!!! | easy-implementation-by-adsulswapnil27-nuvy | IntuitionApproachComplexity
Time complexity: O(n*log(n))
Space complexity: O(1)
Code | adsulswapnil27 | NORMAL | 2025-02-11T13:53:20.270110+00:00 | 2025-02-11T13:53:20.270110+00:00 | 25 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity: O(n*log(n))
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n... | 0 | 0 | ['Binary Search', 'C++'] | 0 |
maximize-the-minimum-game-score | Binary Search Solution With Comments. | binary-search-solution-with-comments-by-kh2gp | Code | vaibhavkhanna8bp | NORMAL | 2025-02-11T13:42:49.767647+00:00 | 2025-02-11T13:45:04.421737+00:00 | 16 | false | # Code
```java []
class Solution {
// In this function, I have used the methodology that how many steps will be taken in total
// for currentIndex, that is i to fulfill its quota, that also includes moving to ith index,
// After every iteration calculation is done so that how many moves were required to ful... | 0 | 0 | ['Java'] | 0 |
maximize-the-minimum-game-score | greedy + binarySearch by coderkb | greedy-binarysearch-by-coderkb-by-coderk-429g | IntuitionWe need to maximize the minimum game score by distributing at most m game moves. The score of a position increases by its respective points[i] value pe | coderkb | NORMAL | 2025-02-11T02:48:44.388297+00:00 | 2025-02-11T02:48:44.388297+00:00 | 21 | false | ### Intuition
We need to **maximize the minimum game score** by distributing at most `m` game moves. The score of a position increases by its respective `points[i]` value per move.
Since we're maximizing a **minimum value**, we can use **binary search** on the possible score range. The idea is to check whether a given... | 0 | 0 | ['Binary Search', 'Greedy', 'Java'] | 0 |
maximize-the-minimum-game-score | Explained | 190ms | ranges::lower_bound views::iota | explained-190ms-rangeslower_bound-viewsi-2ixd | IntuitionMaximize the minimum game score by strategically distributing limited moves across array elements, using binary search to find the optimal minimum scor | ivangnilomedov | NORMAL | 2025-02-10T19:38:22.906598+00:00 | 2025-02-10T19:38:22.906598+00:00 | 14 | false | # Intuition
Maximize the minimum game score by strategically distributing limited moves across array elements, using binary search to find the optimal minimum score.
# Approach
1. **Binary Search on Answer**
- Instead of brute-forcing all possible move distributions, we search for the maximum achievable minimum sco... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | JAVA SOLUTION (BINARY SEARCH) | java-solution-binary-search-by-divyansh_-o8kg | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | divyansh_2069 | NORMAL | 2025-02-10T17:21:55.160810+00:00 | 2025-02-10T17:21:55.160810+00:00 | 12 | 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 | ['Java'] | 0 |
maximize-the-minimum-game-score | Simple Binary Search | simple-binary-search-by-catchme999-r6jg | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | catchme999 | NORMAL | 2025-02-10T17:20:32.428526+00:00 | 2025-02-10T17:20:32.428526+00:00 | 29 | 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 |
maximize-the-minimum-game-score | O(n*log(n) Binary search | onlogn-binary-search-by-luudanhhieu-yf1l | Intuition
Binary search log(n) and loop points -> O(n*log(n)) enough to pass this problem.
Try to every value from 0 -> max_int to check
How to loop points and | luudanhhieu | NORMAL | 2025-02-10T14:28:06.918558+00:00 | 2025-02-10T14:28:06.918558+00:00 | 13 | false | # Intuition
- Binary search log(n) and loop points -> O(n*log(n)) enough to pass this problem.
- Try to every value from 0 -> `max_int` to check
- How to loop points and check with value `vl` ?
- Start at `i = 0` and try to go to last of `points[i]` and ensure that `points[i]>= vl`
# Complexity
- Time complexity:... | 0 | 0 | ['Go'] | 0 |
maximize-the-minimum-game-score | [Golang] Binary Search | golang-binary-search-by-silencerbupt-25kf | Given an integer bound, figure out the number of moves required to make gamescore[i] >= bound for all i. Use binary search to find the largest bound.Code | SilencerBUPT | NORMAL | 2025-02-10T13:58:54.151105+00:00 | 2025-02-10T13:58:54.151105+00:00 | 7 | false | Given an integer `bound`, figure out the number of moves required to make `gamescore[i] >= bound` for all `i`. Use binary search to find the largest `bound`.
# Code
```golang []
func maxScore(points []int, m int) int64 {
check := func(bound int) bool {
a, b := 0, 0
moves := 0
for i := 0; i < len(points)-1; i++... | 0 | 0 | ['Binary Search', 'Go'] | 0 |
maximize-the-minimum-game-score | My Solution | my-solution-by-hope_ma-0h2p | null | hope_ma | NORMAL | 2025-02-10T13:56:43.716213+00:00 | 2025-02-15T14:16:52.979261+00:00 | 16 | false | ```
/**
* the binary search solution is employed.
*
* Time Complexity: O(n * log(u))
* Space Complexity: O(1)
* where `n` is the length of the vector `points`
* `u` is (`m` * `min_point`)
* `min_point` is the minimum element of the vector `points`
*/
class Solution {
public:
long long maxScore(co... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Binary search/Greedy | binary-searchgreedy-by-jianstanleya-eg84 | IntuitionDidn't have time to do this contest in person, but it would have been nice. This question is the maximum-minimum type, which strongly suggests the use | jianstanleya | NORMAL | 2025-02-10T07:22:09.438338+00:00 | 2025-02-10T07:22:09.438338+00:00 | 18 | false | # Intuition
Didn't have time to do this contest in person, but it would have been nice. This question is the maximum-minimum type, which strongly suggests the use of binary search.
# Approach
We may ignore the specific values of points and consider the number of times each index is visited. Starting from the left, we ... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Simple Binary Search | simple-binary-search-by-bhaaratkhatri-iqbs | IntuitionWe will simply try to find minimum answer using binary search.ApproachWe will never decrease, we will always increase for every move.
For every index f | BhaaratKhatri | NORMAL | 2025-02-10T02:36:26.293939+00:00 | 2025-02-10T02:36:26.293939+00:00 | 25 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
We will simply try to find minimum answer using binary search.
# Approach
<!-- Describe your approach to solving the problem. -->
We will never decrease, we will always increase for every move.
1. For every index first we calculate how muc... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | [Python 3]Binary Search | python-3binary-search-by-chestnut890123-8mh5 | null | chestnut890123 | NORMAL | 2025-02-09T19:36:16.496601+00:00 | 2025-02-09T19:37:02.471424+00:00 | 21 | false |
```python3 []
class Solution:
def maxScore(self, points: List[int], m: int) -> int:
n = len(points)
def dp(target):
if not target:
return True
cnt = 0
prev_moves = 0
prev_idx = -1
i = 0
while i < n:
... | 0 | 0 | ['Binary Search', 'Python3'] | 0 |
maximize-the-minimum-game-score | JAVA || Beats 100% || Binary Search | java-beats-100-binary-search-by-jai_hanu-73tf | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | jai_hanumant | NORMAL | 2025-02-09T19:25:16.266887+00:00 | 2025-02-09T19:25:16.266887+00:00 | 23 | 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 | ['Java'] | 0 |
maximize-the-minimum-game-score | Maximize the Minimum Game Score [Beats 100% Speed & Storage] | maximize-the-minimum-game-score-beats-10-pn3h | Maximize the Minimum Game Score [Beats 100% Speed & Storage]IntuitionThe problem involves maximizing the minimum score in a game with limited moves. A binary se | hoanghung3011 | NORMAL | 2025-02-09T17:31:59.014657+00:00 | 2025-02-09T17:31:59.014657+00:00 | 57 | false | # Maximize the Minimum Game Score [Beats 100% Speed & Storage]
## Intuition
The problem involves maximizing the minimum score in a game with limited moves. A binary search approach is ideal because we can efficiently narrow down the maximum possible minimum score by checking feasibility for each candidate.
## Approac... | 0 | 0 | ['Binary Search', 'Dynamic Programming', 'Greedy', 'Java'] | 0 |
maximize-the-minimum-game-score | Simple binary search intuitive solution C++ | simple-binary-search-intuitive-solution-07lek | Code | VaidantJain | NORMAL | 2025-02-09T16:34:47.598751+00:00 | 2025-02-09T16:34:47.598751+00:00 | 44 | false |
# Code
```cpp []
class Solution {
public:
bool isValid(vector<int>&points, long long sol, long long m){
vector<long long> cnt;
for(int x : points) {
cnt.push_back((sol + x - 1) / x);
}
cnt.push_back(0);
long long move = 0;
for(int i = 0; i < points.si... | 0 | 0 | ['Binary Search', 'C++'] | 0 |
maximize-the-minimum-game-score | ez c# | ez-c-by-ice__fizz-7uc8 | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | ice__fizz | NORMAL | 2025-02-09T15:00:35.384841+00:00 | 2025-02-09T15:00:35.384841+00:00 | 11 | 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 |
maximize-the-minimum-game-score | Python Hard | python-hard-by-lucasschnee-bv4i | null | lucasschnee | NORMAL | 2025-02-09T14:51:50.534965+00:00 | 2025-02-09T14:51:50.534965+00:00 | 15 | false | ```python3 []
class Solution:
def maxScore(self, points: List[int], m: int) -> int:
N = len(points)
mn = min(points)
mx = max(points)
def good(target):
carry = 0
moves = 0
i = 0
for x in points:
i += 1
... | 0 | 0 | ['Python3'] | 0 |
maximize-the-minimum-game-score | Binary Search Simple Solution (Similar question and Striver Explanation link pasted) | binary-search-simple-solution-similar-qu-1n81 | IntuitionSimilar to this concepthttps://leetcode.com/problems/koko-eating-bananas/description/Striver Explanation on same approach--
I will highly recommend to | shivnath | NORMAL | 2025-02-09T14:20:53.519355+00:00 | 2025-02-09T14:20:53.519355+00:00 | 57 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Similar to this concept
https://leetcode.com/problems/koko-eating-bananas/description/
Striver Explanation on same approach--
I will highly recommend to watch this video before jumping to solve this question.
https://www.youtube.com/wat... | 0 | 0 | ['Binary Search', 'C++'] | 0 |
maximize-the-minimum-game-score | [C++] Binary Search + Greedy | c-binary-search-greedy-by-projectcoder-e5yq | Code | projectcoder | NORMAL | 2025-02-09T10:52:10.753435+00:00 | 2025-02-09T10:52:10.753435+00:00 | 43 | false |
# Code
```cpp []
typedef long long ll;
class Solution {
public:
long long maxScore(vector<int>& a, int T) { int n = a.size();
auto check = [&](ll limit) -> bool {
ll s = 0, e = 0, k = 0;
for (int i = 1; i <= n; i++) {
k = (limit-1)/a[i-1] + 1;
... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | Binary Search | binary-search-by-maxorgus-b42s | Binary search, below is the explanation for the 'possible' function. Reat are trivial BS roadmaps.Fix the minimum value x we want to getGo over the pointsWhen v | MaxOrgus | NORMAL | 2025-02-09T09:56:24.847037+00:00 | 2025-02-09T09:56:24.847037+00:00 | 19 | false | Binary search, below is the explanation for the 'possible' function. Reat are trivial BS roadmaps.
Fix the minimum value x we want to get
Go over the points
When visiting index i, it costs on jump. Suppose we have visited t times the index i where the point is p, subtract i*(p+1) from x (+1 comes from the operation... | 0 | 0 | ['Binary Search', 'Python3'] | 0 |
maximize-the-minimum-game-score | Rust Solution | rust-solution-by-abhineetraj1-079e | IntuitionThe problem involves determining the maximum score that can be achieved under the constraint of performing no more than m operations on a given set of | abhineetraj1 | NORMAL | 2025-02-09T08:31:41.288894+00:00 | 2025-02-09T08:31:41.288894+00:00 | 16 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem involves determining the maximum score that can be achieved under the constraint of performing no more than m operations on a given set of points. A brute force approach would not be efficient, especially if the values of n and ... | 0 | 0 | ['Binary Search', 'Dynamic Programming', 'Rust'] | 0 |
maximize-the-minimum-game-score | Binary search [Python3] | binary-search-python3-by-kevin_pan-pghi | Binary search for the maximum minimum value. For a value x, try to make every element in the array at least x.
We need to visit each index at least once if x is | kevin_pan | NORMAL | 2025-02-09T04:59:37.311415+00:00 | 2025-02-09T05:01:00.428662+00:00 | 28 | false | Binary search for the maximum minimum value. For a value $$x$$, try to make every element in the array at least $$x$$.
We need to visit each index at least once if $$x$$ is non-zero. It is optimal to traverse left to right and alternate between adjacent indices to satisfy the minimum value.
# Complexity
Let M be the ... | 0 | 0 | ['Python3'] | 0 |
maximize-the-minimum-game-score | Not very hard, but prone to bugs | not-very-hard-but-prone-to-bugs-by-metap-q7s6 | IntuitionThe framework is simple: binary search for finding the answer.ApproachTo check if an answer t is valid, we simulate the process from i = -1 to n-1.
For | metaphysicalist | NORMAL | 2025-02-09T04:38:27.354530+00:00 | 2025-02-09T05:02:31.738831+00:00 | 58 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The framework is simple: binary search for finding the answer.
# Approach
<!-- Describe your approach to solving the problem. -->
To check if an answer `t` is valid, we simulate the process from `i = -1` to `n-1`.
For making `scores[i] >... | 0 | 0 | ['Binary Search', 'Simulation', 'Python3'] | 0 |
maximize-the-minimum-game-score | C++ | c-by-user5976fh-tcmx | null | user5976fh | NORMAL | 2025-02-09T04:25:45.010840+00:00 | 2025-02-09T04:54:12.560642+00:00 | 36 | false | ```cpp []
class Solution {
public:
long long maxScore(vector<int>& points, int m) {
long long ans = 0, l = 0, r = 1e16;
vector<long long> p(points.begin(), points.end());
while (l <= r){
long long mid = (l + r) / 2;
if (valid(mid, p, m)) ans = mid, l = mid + 1;
... | 0 | 0 | ['C++'] | 0 |
maximize-the-minimum-game-score | [C++] Greedy + Binary Search Explained | c-greedy-binary-search-by-yvi55kfihx-kwhd | IntuitionGiven a specific maximum possible minimum value (MPM), you can check whether it can be fulfiled within m moves in O(N) time.
Use binary search to narr | YVI55KFiHX | NORMAL | 2025-02-09T04:16:07.078086+00:00 | 2025-02-09T04:24:21.204447+00:00 | 111 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Given a specific **maximum possible minimum** value (MPM), you can check whether it can be fulfiled within m moves in O(N) time.
1. Use binary search to narrow down the search space of possible **maximum possible minimum** values. `O(log N... | 0 | 0 | ['C++'] | 0 |
surface-area-of-3d-shapes | [C++/Java/1-line Python] Minus Hidden Area | cjava1-line-python-minus-hidden-area-by-5ms83 | Intuition:\nFor each tower, its surface area is 4 * v + 2\nHowever, 2 adjacent tower will hide the area of connected part.\nThe hidden part is min(v1, v2) and w | lee215 | NORMAL | 2018-08-26T03:01:27.146921+00:00 | 2018-10-24T22:24:45.757523+00:00 | 12,098 | false | **Intuition**:\nFor each tower, its surface area is `4 * v + 2`\nHowever, 2 adjacent tower will hide the area of connected part.\nThe hidden part is `min(v1, v2)` and we need just minus this area * 2\n\n**Time Complexity**:\nO(N^2)\n\n**C++:**\n```\n int surfaceArea(vector<vector<int>> grid) {\n int res = 0, ... | 289 | 3 | [] | 34 |
surface-area-of-3d-shapes | 892. Surface Area of 3D Shapes. C++ solution with visual presentation | 892-surface-area-of-3d-shapes-c-solution-rl6s | Surface area of 1 cube is equal to 6 according to description (1 * 1 * 1) * 6, cube have 6 sides.\ngrid[i][j] is a count of cubes placed on top of grid cell. Fo | langrenn | NORMAL | 2020-01-07T09:55:30.534076+00:00 | 2020-03-21T16:37:23.287519+00:00 | 3,266 | false | Surface area of 1 cube is equal to 6 according to description (1 * 1 * 1) * 6, cube have 6 sides.\ngrid[i][j] is a count of cubes placed on top of grid cell. For instance, if we have a grid[i][j] = 2, it means we placed two cubes one on other and they have a common area is equal to 2, because we have two connected side... | 40 | 0 | ['Geometry', 'C'] | 6 |
surface-area-of-3d-shapes | Simple Python explained | simple-python-explained-by-sunakshi132-ruhr | \nclass Solution:\n def surfaceArea(self, grid: List[List[int]]) -> int:\n \n l = len(grid)\n area=0\n for row in range(l):\n | sunakshi132 | NORMAL | 2022-07-25T00:52:52.416545+00:00 | 2022-07-25T00:52:52.416588+00:00 | 1,973 | false | ```\nclass Solution:\n def surfaceArea(self, grid: List[List[int]]) -> int:\n \n l = len(grid)\n area=0\n for row in range(l):\n for col in range(l):\n if grid[row][col]:\n area += (grid[row][col]*4) +2 #surface area of each block if blocks wer... | 11 | 0 | ['Python', 'Python3'] | 0 |
surface-area-of-3d-shapes | [Java] 1 pass 9 line concise code, find contact surface area difference . | java-1-pass-9-line-concise-code-find-con-86hb | Compute the cubes\' contact surface area difference in x and y directions, recpectively; as for the area seen along z-axis, count the number of non-zero values | rock | NORMAL | 2018-08-26T03:04:42.969754+00:00 | 2018-08-26T05:51:05.149319+00:00 | 848 | false | Compute the cubes\' **contact surface area difference** in x and y directions, recpectively; as for the area seen along z-axis, count the number of non-zero values and times 2.\n\n```\n public int surfaceArea(int[][] grid) {\n int x = 0, y = 0, z = 0, n = grid.length;\n for (int i = 0; i < n; x += grid... | 8 | 0 | [] | 1 |
surface-area-of-3d-shapes | Python | Easy | Matrix | Surface Area of 3D Shapes | python-easy-matrix-surface-area-of-3d-sh-nnh3 | \nsee the Successfully Accepted Submission\nPython\nclass Solution(object):\n def surfaceArea(self, grid):\n n = len(grid)\n res = 0\n\n | Khosiyat | NORMAL | 2023-10-07T15:06:01.566216+00:00 | 2023-10-07T15:06:01.566236+00:00 | 305 | false | \n[see the Successfully Accepted Submission](https://leetcode.com/submissions/detail/1066993426/)\n```Python\nclass Solution(object):\n def surfaceArea(self, grid):\n n = len(grid)\n res = 0\n\n for i in range(n):\n for j in range(n):\n if grid[i][j] == 0:\n ... | 6 | 0 | ['Matrix', 'Python'] | 0 |
surface-area-of-3d-shapes | JavaScript solution | javascript-solution-by-shengdade-dfpl | javascript\n/**\n * @param {number[][]} grid\n * @return {number}\n */\nvar surfaceArea = function(grid) {\n const height = grid.length;\n const width = grid[ | shengdade | NORMAL | 2020-02-17T21:48:43.118765+00:00 | 2020-02-17T21:48:43.118816+00:00 | 433 | false | ```javascript\n/**\n * @param {number[][]} grid\n * @return {number}\n */\nvar surfaceArea = function(grid) {\n const height = grid.length;\n const width = grid[0].length;\n let sum = 0;\n for (let i = 0; i < height; i++) {\n for (let j = 0; j < width; j++) {\n if (grid[i][j] > 0) sum += grid[i][j] * 4 + 2;... | 6 | 0 | ['JavaScript'] | 1 |
surface-area-of-3d-shapes | Python easy-to-understand solution (52ms) | python-easy-to-understand-solution-52ms-xi05o | \nclass Solution:\n def surfaceArea(self, grid):\n """\n :type grid: List[List[int]]\n :rtype: int\n """\n n = len(grid)\n | kyungminlee | NORMAL | 2018-12-13T00:28:10.819028+00:00 | 2018-12-13T00:28:10.819074+00:00 | 1,065 | false | ```\nclass Solution:\n def surfaceArea(self, grid):\n """\n :type grid: List[List[int]]\n :rtype: int\n """\n n = len(grid)\n m = len(grid[0])\n \n\t\t# surfaces perpendicular to x-axis\n area_x = 0\n for i in range(n):\n prev_height = 0 \n ... | 6 | 0 | [] | 2 |
surface-area-of-3d-shapes | Java simple solution | java-simple-solution-by-geeksnap-35ed | Surface area of a cube = 6*(side)^2 (In this problem side = 1)\n2. If the value in grid[i][j] > 1 i.e. top/bottom will overlap; subtract 2\n3. check for previou | geeksnap | NORMAL | 2018-08-26T03:56:50.569173+00:00 | 2018-10-18T02:46:24.879077+00:00 | 1,571 | false | 1. Surface area of a cube = 6*(side)^2 (In this problem side = 1)\n2. If the value in grid[i][j] > 1 i.e. top/bottom will overlap; subtract 2\n3. check for previous row and previous column for any overlapping too\n\n```\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int res = 0;\n \n ... | 6 | 0 | [] | 1 |
surface-area-of-3d-shapes | Simple java code 1 ms beats 100 % | simple-java-code-1-ms-beats-100-by-arobh-clmt | \n# Complexity\n\n\n# Code\n\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int result = 0;\n for (int i = 0; i < grid.length; i+ | Arobh | NORMAL | 2024-05-10T15:05:49.555965+00:00 | 2024-05-10T15:05:49.556002+00:00 | 451 | false | \n# Complexity\n\n\n# Code\n```\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int result = 0;\n for (int i = 0; i < grid.length; i++) for (int j = 0; j < grid[0].length; j... | 5 | 0 | ['Array', 'Math', 'Geometry', 'Matrix', 'Java'] | 0 |
surface-area-of-3d-shapes | C++ | Very Easy Code with Explanation | c-very-easy-code-with-explanation-by-ank-9p1u | Please Upvote :)\n\n\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int res=0;\n for(int i=0;i<grid.size();i++)\n | ankit4601 | NORMAL | 2022-07-24T09:08:30.840709+00:00 | 2022-07-24T09:08:30.840738+00:00 | 1,009 | false | Please Upvote :)\n\n```\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int res=0;\n for(int i=0;i<grid.size();i++)\n {\n for(int j=0;j<grid[0].size();j++)\n {\n if(grid[i][j])\n {\n res+=2; // 1 f... | 5 | 0 | ['C', 'C++'] | 0 |
surface-area-of-3d-shapes | Python solution | python-solution-by-faceplant-rhc5 | \tresult = 0\n\tfor i in range(len(grid)):\n\t\tfor j in range(len(grid)):\n\t\t\tif grid[i][j] > 0:\n\t\t\t\tresult += grid[i][j] * 4 + 2\n\t\t\t\tif i + 1 < l | FACEPLANT | NORMAL | 2021-01-17T15:50:01.694127+00:00 | 2021-01-17T15:50:01.694175+00:00 | 509 | false | \tresult = 0\n\tfor i in range(len(grid)):\n\t\tfor j in range(len(grid)):\n\t\t\tif grid[i][j] > 0:\n\t\t\t\tresult += grid[i][j] * 4 + 2\n\t\t\t\tif i + 1 < len(grid):\n\t\t\t\t\tresult -= min(grid[i][j], grid[i + 1][j]) * 2\n\t\t\t\tif j + 1 < len(grid):\n\t\t\t\t\tresult -= min(grid[i][j], grid[i][j + 1]) * 2\n\tre... | 5 | 0 | [] | 1 |
surface-area-of-3d-shapes | [Python] faster than 99%, compute only three faces then get the answer | python-faster-than-99-compute-only-three-3cmq | python\nclass Solution:\n def surfaceArea(self, grid):\n top = 0\n for row in grid:\n for num in row:\n if num > 0:\n | kuanc | NORMAL | 2019-08-29T15:38:28.092768+00:00 | 2019-08-29T15:38:28.092805+00:00 | 579 | false | ```python\nclass Solution:\n def surfaceArea(self, grid):\n top = 0\n for row in grid:\n for num in row:\n if num > 0:\n top += 1\n\n left = 0\n for row in grid:\n std = 0\n for num in row:\n if num - std > ... | 5 | 0 | ['Python'] | 2 |
surface-area-of-3d-shapes | Python - simple explanation | python-simple-explanation-by-aac123-gkhv | The surface area of a rectangular prism of height h sitting on a 1x1 square = 2 + 4 * h.\n\nThe overlap (double counting) of surface area between a prism and a | aac123 | NORMAL | 2020-09-05T02:13:29.403670+00:00 | 2020-09-05T02:22:34.148223+00:00 | 304 | false | The surface area of a rectangular prism of height h sitting on a 1x1 square = 2 + 4 * h.\n\nThe overlap (double counting) of surface area between a prism and a neighboring prism is 2 * min(h(curr), h(nei)). This is because each of the two prisms is double counting the face that touches, e.g. the face that represents th... | 4 | 0 | [] | 0 |
surface-area-of-3d-shapes | C++ || 99.97% faster || Easy to understand | c-9997-faster-easy-to-understand-by-anon-aabz | \nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int result = 0;\n for(int i=0;i<grid.size();i++){\n for | anonymous_kumar | NORMAL | 2020-06-29T07:08:36.419741+00:00 | 2020-06-29T07:09:53.277594+00:00 | 487 | false | ```\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int result = 0;\n for(int i=0;i<grid.size();i++){\n for(int j=0;j<grid[0].size();j++){\n int val = grid[i][j];\n if(val >= 2){\n result += 10 + 4 * (val - 2);\n ... | 4 | 1 | ['C', 'C++'] | 0 |
surface-area-of-3d-shapes | Javascript easy solution! | javascript-easy-solution-by-bundit-8y4c | We first add the whole surface area of the tower. Then we subtract the overlapping \'walls.\' \nDo this for every tower.\n\nvar surfaceArea = function(grid) {\n | bundit | NORMAL | 2018-12-12T04:55:25.611115+00:00 | 2018-12-12T04:55:25.611183+00:00 | 257 | false | We first add the whole surface area of the tower. Then we subtract the overlapping \'walls.\' \nDo this for every tower.\n```\nvar surfaceArea = function(grid) {\n let area = 0;\n \n for (let i in grid) {\n for (let j in grid) {\n\t\t\n if (grid[i][j]) { \n area += (grid[i][j]... | 4 | 0 | [] | 0 |
surface-area-of-3d-shapes | Python iterative solution | python-iterative-solution-by-cenkay-fxmw | Surface area of each cell is 4 * lateral area + upper and lower face unit areas.\n* For each cell, neighbour cells blocks some area, which is the minimum of 2 c | cenkay | NORMAL | 2018-08-26T07:09:30.206336+00:00 | 2018-10-24T22:23:05.527760+00:00 | 306 | false | * Surface area of each cell is 4 * lateral area + upper and lower face unit areas.\n* For each cell, neighbour cells blocks some area, which is the minimum of 2 cells taken into account.\n```\nclass Solution:\n def surfaceArea(self, grid):\n n, sm = len(grid), 0\n for i in range(n):\n for j ... | 4 | 0 | [] | 0 |
surface-area-of-3d-shapes | Java Understandable Solution | java-understandable-solution-by-tbekpro-bcli | Code\n\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int sum = 0;\n for (int i = 0; i < grid.length; i++) {\n for (in | tbekpro | NORMAL | 2022-12-13T05:51:43.504048+00:00 | 2022-12-13T05:51:43.504074+00:00 | 1,364 | false | # Code\n```\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int sum = 0;\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n int h = grid[i][j];\n int fullS = h > 0 ? h * 4 + 2 : 0;\n //check adjac... | 3 | 0 | ['Java'] | 0 |
surface-area-of-3d-shapes | [Javascript] OVERLAPPING happens in 3 directions! | javascript-overlapping-happens-in-3-dire-ay9t | Since there might be holes in shapes, whose surface areas couldn\'t be projected.\nWe CANNOT use the 2883. Projection Area of 3D Shapes to solve it : (\n.\n\nIn | lynn19950915 | NORMAL | 2022-04-20T06:25:03.487518+00:00 | 2024-04-20T05:15:17.279902+00:00 | 355 | false | Since there might be **holes** in shapes, whose surface areas couldn\'t be projected.\nWe CANNOT use the 2*[883. Projection Area of 3D Shapes](https://leetcode.com/problems/projection-area-of-3d-shapes/) to solve it : (\n.\n\n**Intuition** \n\nWe have to focus on **overlapping** occurrence then.\n\n```\nAssume there ar... | 3 | 0 | ['JavaScript'] | 1 |
surface-area-of-3d-shapes | C++ || EASY TO UNDERSTAND | c-easy-to-understand-by-aarindey-yjtb | \nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int ans=0,n=grid.size();\n if(n==1)\n {\n if(grid[0] | aarindey | NORMAL | 2021-12-17T00:57:05.335417+00:00 | 2021-12-17T00:57:05.335446+00:00 | 392 | false | ```\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int ans=0,n=grid.size();\n if(n==1)\n {\n if(grid[0][0]>0)\n ans+=2;\n ans+=4*grid[0][0];\n return ans;\n }\n for(int i=0;i<n;i++)\n {\n for(int... | 3 | 1 | ['C'] | 0 |
surface-area-of-3d-shapes | (C++) 892. Surface Area of 3D Shapes | c-892-surface-area-of-3d-shapes-by-qeetc-tqzn | \n\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int ans = 0, n = grid.size(); \n for (int i = 0; i < n; ++i) {\n | qeetcode | NORMAL | 2021-04-17T04:29:33.584083+00:00 | 2021-04-17T04:29:33.584129+00:00 | 459 | false | \n```\nclass Solution {\npublic:\n int surfaceArea(vector<vector<int>>& grid) {\n int ans = 0, n = grid.size(); \n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < n; ++j) {\n if (grid[i][j]) {\n ans += 4*grid[i][j] + 2; \n if (i) ans -... | 3 | 0 | ['C'] | 0 |
surface-area-of-3d-shapes | More clear python solution | more-clear-python-solution-by-chinaxuefe-6p0x | python\nclass Solution:\n def surfaceArea(self, grid: List[List[int]]) -> int:\n N = len(grid)\n ret = 0\n for i in range(N):\n | chinaxuefei | NORMAL | 2020-11-10T03:59:06.466715+00:00 | 2020-11-10T03:59:06.466746+00:00 | 398 | false | ```python\nclass Solution:\n def surfaceArea(self, grid: List[List[int]]) -> int:\n N = len(grid)\n ret = 0\n for i in range(N):\n for j in range(N):\n v = grid[i][j]\n if v:\n ret += 2\n ret += v * 4\n ... | 3 | 0 | ['Python3'] | 0 |
surface-area-of-3d-shapes | Java solution | java-solution-by-tankztc-qqb9 | \nclass Solution {\n public int surfaceArea(int[][] grid) {\n int area = 0;\n for (int i = 0; i < grid.length; i++) {\n for (int j = | tankztc | NORMAL | 2018-09-25T04:44:43.589309+00:00 | 2018-10-23T14:38:50.230032+00:00 | 476 | false | ```\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int area = 0;\n for (int i = 0; i < grid.length; i++) {\n for (int j = 0; j < grid[0].length; j++) {\n if (grid[i][j] != 0) {\n area += grid[i][j] * 4 + 2;\n area -= (i - 1 >... | 3 | 0 | [] | 1 |
surface-area-of-3d-shapes | Easy C++ solution || Beginner Friendly | easy-c-solution-beginner-friendly-by-suj-lgyt | 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 | Sujay0_o | NORMAL | 2023-07-02T13:57:09.442977+00:00 | 2023-07-02T13:57:09.443008+00:00 | 1,098 | 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^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.... | 2 | 0 | ['C++'] | 1 |
surface-area-of-3d-shapes | C++,Logical | clogical-by-nideesh45-9dhw | \nclass Solution {\npublic:\n \n // split the area in different part and find individual ones\n \n int surfaceArea(vector<vector<int>>& grid) {\n | nideesh45 | NORMAL | 2022-07-31T06:30:33.621128+00:00 | 2022-07-31T06:30:33.621174+00:00 | 492 | false | ```\nclass Solution {\npublic:\n \n // split the area in different part and find individual ones\n \n int surfaceArea(vector<vector<int>>& grid) {\n int n = grid.size();\n int m = grid[0].size();\n int bottom_top_area = 2*n*m;\n for(int i=0;i<n;i++){\n for(int j=0;j<m;... | 2 | 0 | ['C'] | 0 |
surface-area-of-3d-shapes | Iterative solution in Python (Reported: 95.28% faster) (Time Complexity O(n^2)) | iterative-solution-in-python-reported-95-m9gw | Report Results\nRuntime: 86 ms, faster than 95.28% of Python3 online submissions for Surface Area of 3D Shapes.\nMemory Usage: 14 MB, less than 24.53% of Python | shaurya-chandhoke | NORMAL | 2022-05-23T06:07:07.157089+00:00 | 2022-05-23T06:08:40.608444+00:00 | 374 | false | #### Report Results\nRuntime: 86 ms, faster than 95.28% of Python3 online submissions for Surface Area of 3D Shapes.\nMemory Usage: 14 MB, less than 24.53% of Python3 online submissions for Surface Area of 3D Shapes.\n\nThis naive implementation favors time over space complexity.\n### Implementation Summary\nFor each `... | 2 | 0 | ['Iterator', 'Python'] | 0 |
surface-area-of-3d-shapes | Java single pass simple solution | java-single-pass-simple-solution-by-eloh-hs5r | Note how I only check two of the adjacent faces and substract them twice instead of checking the 4 adjacent faces. if it helps please vote up\n```\nclass Soluti | elohimmarron | NORMAL | 2022-03-12T01:01:18.367637+00:00 | 2022-03-12T01:01:18.367666+00:00 | 175 | false | Note how I only check two of the adjacent faces and substract them twice instead of checking the 4 adjacent faces. if it helps please vote up\n```\nclass Solution {\n public int surfaceArea(int[][] grid) {\n int faces = 0; // keeping 2 variables for redability you could add and subtract on each position;\n ... | 2 | 0 | [] | 0 |
surface-area-of-3d-shapes | Python 3 : Long Code But Faster And Acceptable | python-3-long-code-but-faster-and-accept-z3gi | Approach: \n1) First we check if there is only one cell in matrix/grid or not.\n If yes then just simply return 6 + 4(the value of cell - 1) : Because 1 cube | deleted_user | NORMAL | 2021-12-04T07:30:07.554643+00:00 | 2021-12-04T12:43:39.105880+00:00 | 266 | false | Approach: \n1) First we check if there is only one cell in matrix/grid or not.\n If yes then just simply return 6 + 4(the value of cell - 1) : Because 1 cube has surface area of 6a^2 i.e. 6 here , everytime a new cube is added at the top of a cube surface area increases by 6-2=4units : as 2 units get glued\n2) If no... | 2 | 0 | ['Math', 'Matrix', 'Python3'] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.