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
select-cells-in-grid-with-maximum-score
Go solution: DFS
go-solution-dfs-by-lainhdev-htyc
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
lainhdev
NORMAL
2024-09-06T19:03:20.033903+00:00
2024-09-06T19:03:20.033932+00:00
51
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
['Depth-First Search', 'Go']
0
select-cells-in-grid-with-maximum-score
C++ || DP || Memoization || Bitmasking || Sorting
c-dp-memoization-bitmasking-sorting-by-a-xszd
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem requires selecting the maximum possible sum of unique values from different
akash92
NORMAL
2024-09-02T04:39:47.548245+00:00
2024-09-02T04:39:47.548273+00:00
115
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem requires selecting the maximum possible sum of unique values from different rows in a 2D grid. Since the number of rows is limited, we can utilize dynamic programming with a bitmask to keep track of the rows from which cells h...
2
0
['Dynamic Programming', 'Recursion', 'Memoization', 'Sorting', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Java - Recursion + Memoization Solution
java-recursion-memoization-solution-by-i-dzj3
java []\nclass Solution {\n private List<List<Integer>> arr;\n private Integer dp[][];\n\n public int maxScore(List<List<Integer>> grid) {\n arr
iamvineettiwari
NORMAL
2024-09-01T04:42:20.832402+00:00
2024-09-01T04:44:38.566309+00:00
426
false
```java []\nclass Solution {\n private List<List<Integer>> arr;\n private Integer dp[][];\n\n public int maxScore(List<List<Integer>> grid) {\n arr = new ArrayList<>();\n dp = new Integer[101][1 << grid.size()];\n\n for (int i = 0; i <= 100; i++) {\n arr.add(new ArrayList<Intege...
2
0
['Dynamic Programming', 'Recursion', 'Memoization', 'Bitmask', 'Java']
1
select-cells-in-grid-with-maximum-score
[Python3] DP bitmask 15 lines
python3-dp-bitmask-15-lines-by-cc189-ijnl
\n# Intuition\n> The condition 1 <= grid.length, grid[i].length <= 10 suggests that the problem\'s constraints are small, making bitmasks a suitable choice for
cc189
NORMAL
2024-09-01T04:15:59.994559+00:00
2024-09-01T05:48:53.734850+00:00
161
false
\n# Intuition\n> The condition `1 <= grid.length, grid[i].length <= 10` suggests that the problem\'s constraints are small, making bitmasks a suitable choice for tracking which rows have been used.\n\nThe goal is to maximize the score by selecting values from the grid while ensuring that each row is used only once. To ...
2
0
['Dynamic Programming', 'Greedy', 'Python3']
0
select-cells-in-grid-with-maximum-score
Simple bitmask solution in Python
simple-bitmask-solution-in-python-by-jyw-4r6e
Approach\nSimple bitmask solution\n\n# Code\npython3 []\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n lr = len(grid)\n
jywyq96
NORMAL
2024-09-07T21:35:54.635233+00:00
2024-09-07T21:35:54.635263+00:00
15
false
# Approach\nSimple bitmask solution\n\n# Code\n```python3 []\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n lr = len(grid)\n lc = len(grid[0])\n values = dict()\n for r in range(lr):\n for c in range(lc):\n x = grid[r][c]\n ...
1
0
['Python3']
0
select-cells-in-grid-with-maximum-score
C++ | DP with Bitmask
c-dp-with-bitmask-by-wlshih-niwi
Intuition\n Describe your first thoughts on how to solve this problem. \nMaximize the sum by greedily selecting the highest values, but it didn\'t work.\n-> use
wlshih
NORMAL
2024-09-03T15:55:20.990967+00:00
2024-11-08T12:42:58.918329+00:00
174
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nMaximize the sum by greedily selecting the highest values, but it didn\'t work.\n-> use DP to get optimum value while ensuring unique row selections.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Flattening and ...
1
0
['C++']
1
select-cells-in-grid-with-maximum-score
DP with Bitmasking O(k*2^11) ✅✅✅
dp-with-bitmasking-ok211-by-ashishpatel1-fy96
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
AshishPatel17
NORMAL
2024-09-03T06:42:14.516708+00:00
2024-09-03T06:42:14.516782+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:\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
['Dynamic Programming', 'Ordered Map', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Readable Code (DFS + Memo + BitMask)
readable-code-dfs-memo-bitmask-by-amoiza-3sm8
Code\npython3 []\nfrom functools import lru_cache\n\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n m, n = len(grid), len(grid[
amoiza1
NORMAL
2024-09-01T23:09:05.522789+00:00
2024-09-01T23:10:16.311205+00:00
99
false
# Code\n```python3 []\nfrom functools import lru_cache\n\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n m, n = len(grid), len(grid[0])\n \n @functools.cache\n def dfs(val, rows_seen_mask):\n if val > 100:\n return 0\n\n best = 0...
1
0
['Python3']
0
select-cells-in-grid-with-maximum-score
Java take not take dp using bitmask , fastest beats 100%
java-take-not-take-dp-using-bitmask-fast-xy13
\nclass Solution {\n public int maxScore(List<List<Integer>> grid) {\n List<List<Integer>> list = new ArrayList<>();\n for (int row = 0; row <
new_born2023
NORMAL
2024-09-01T19:12:45.038916+00:00
2024-09-01T19:22:23.762621+00:00
87
false
```\nclass Solution {\n public int maxScore(List<List<Integer>> grid) {\n List<List<Integer>> list = new ArrayList<>();\n for (int row = 0; row < grid.size(); row++) {\n for (int col = 0; col < grid.getFirst().size(); col++) {\n list.add(List.of(row, col));\n }\n ...
1
0
['Sorting', 'Binary Tree', 'Bitmask', 'Java']
1
select-cells-in-grid-with-maximum-score
c++ solution using memoization
c-solution-using-memoization-by-dilipsut-ngnj
\nclass Solution {\npublic:\n vector<int>mat[101];\n int dp[101][(1<<10)+1];\n int find(int num,int mask){\n if(num==0) return 0;\n if(dp
dilipsuthar17
NORMAL
2024-09-01T16:53:50.559341+00:00
2024-09-01T16:53:50.559375+00:00
52
false
```\nclass Solution {\npublic:\n vector<int>mat[101];\n int dp[101][(1<<10)+1];\n int find(int num,int mask){\n if(num==0) return 0;\n if(dp[num][mask]!=-1) return dp[num][mask];\n int ans=find(num-1,mask);\n for(auto &it:mat[num]){\n if((mask&(1<<it))) continue;\n ...
1
0
['Dynamic Programming', 'Memoization', 'C', 'C++']
0
select-cells-in-grid-with-maximum-score
DFS solution using recursion in Python
dfs-solution-using-recursion-in-python-b-fi9t
Intuition\n Describe your first thoughts on how to solve this problem. \nWhen I first read this problem I tried using a greedy approach. I would first sort each
adarshmohapatra10
NORMAL
2024-09-01T15:15:02.917187+00:00
2024-11-13T16:07:54.224632+00:00
79
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWhen I first read this problem I tried using a greedy approach. I would first sort each row, then go through every row and try to pick the largest number possible. If it conflicted with another row I would try to resolve the conflict. It ...
1
0
['Depth-First Search', 'Recursion', 'Python3']
1
select-cells-in-grid-with-maximum-score
Not easy but understandable solution c++ (beats 100% users)
not-easy-but-understandable-solution-c-b-zsmd
Intuition\nwhen we see these type of problem with several possible choices one thing comes into our mind is the Dynamic Programming and here also one thing matt
Divyansh55BE29
NORMAL
2024-09-01T12:57:33.527595+00:00
2024-09-01T12:57:33.527622+00:00
33
false
# Intuition\nwhen we see these type of problem with several possible choices one thing comes into our mind is the Dynamic Programming and here also one thing matters the similarity in the type of the selection we got like we have to deal with the same type of the values from diffrent rows together and decide for a sele...
1
0
['C++', 'Python3']
0
select-cells-in-grid-with-maximum-score
Simple and Best Solution. Beats 💯 in both Runtime and Memory🎉
simple-and-best-solution-beats-in-both-r-8zyt
\n\n\n# Code\ncpp []\nclass Solution {\n int f[2][1024], a[101];\npublic:\n int maxScore(vector<vector<int>>& grid) {\n int n = grid.size(), m = gr
Sahil_934
NORMAL
2024-09-01T12:09:32.493626+00:00
2024-09-01T12:09:32.493654+00:00
22
false
![image.png](https://assets.leetcode.com/users/images/450c88ae-f88e-4cc6-859e-4bd70842b188_1725192551.9762223.png)\n\n\n# Code\n```cpp []\nclass Solution {\n int f[2][1024], a[101];\npublic:\n int maxScore(vector<vector<int>>& grid) {\n int n = grid.size(), m = grid[0].size(), N = 1 << n;\n\n for (i...
1
0
['C++']
0
select-cells-in-grid-with-maximum-score
Optimized Solution with Detailed Explanation: Beats 100% in Runtime and 64.71% in Memory
optimized-solution-with-detailed-explana-8v0k
Intuition\n Describe your first thoughts on how to solve this problem. \nFor each unique value, store the rows in which it appears. We now have a maximum of \uD
abanoubashraf
NORMAL
2024-09-01T11:45:14.188095+00:00
2024-09-01T11:45:14.188126+00:00
33
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFor each unique value, store the rows in which it appears. We now have a maximum of $$\uD835\uDC41\xD7\uD835\uDC40$$ unique values, where for each value, we can have at most $$N$$ rows. Here, $$N$$ represents the number of rows, and $$M$$...
1
0
['Dynamic Programming', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Solution using constraints | O(100*2^10) | Recursion(Backtracking) | C++
solution-using-constraints-o100210-recur-09pa
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
jeetdavecp
NORMAL
2024-09-01T10:25:17.807848+00:00
2024-09-01T10:25:17.807873+00:00
151
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( 100* 2^10 )\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution ...
1
0
['Backtracking', 'Depth-First Search', 'Recursion', 'C++']
1
select-cells-in-grid-with-maximum-score
C++ greedy + bitmask dp solution
c-greedy-bitmask-dp-solution-by-malpani_-t30y
Intuition\n Describe your first thoughts on how to solve this problem. \nThe intuition here is that we can traverse through the rows and keep a bitmask of the n
malpani_yashasva
NORMAL
2024-09-01T09:43:25.154167+00:00
2024-09-01T09:43:25.154198+00:00
40
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition here is that we can traverse through the rows and keep a bitmask of the numbers taken. However the maximum value of the number can be 100 and (2^100) bits will be required to represent them.\nHence a better approach is to ke...
1
0
['Dynamic Programming', 'Greedy', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Dynamic Programming with Bitmasking
dynamic-programming-with-bitmasking-by-b-7yma
Approach Breakdown\nThis problem can be approached using Dynamic Programming combined with Bitmasking. The general idea is to recursively explore the possible s
B_I_T
NORMAL
2024-09-01T08:58:01.348859+00:00
2024-09-01T08:58:01.348881+00:00
12
false
# Approach Breakdown\nThis problem can be approached using Dynamic Programming combined with Bitmasking. The general idea is to recursively explore the possible selections, using dynamic programming to store intermediate results for optimization.\n\n# Explanation of Code\n1. Initialize the Dynamic Programming Array (dp...
1
0
['Dynamic Programming', 'Bit Manipulation', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Best DP + Bit Masking Approach
best-dp-bit-masking-approach-by-chakradh-60tu
Intuition\nThe bitmask is used to track which rows have been visited, and dp to memoize.\n\n# Approach\nPrecomputation\nI\'m first storing the row number of all
chakradhar03
NORMAL
2024-09-01T06:51:59.308695+00:00
2024-09-01T06:51:59.308736+00:00
159
false
# Intuition\nThe bitmask is used to track which rows have been visited, and dp to memoize.\n\n# Approach\n**Precomputation**\nI\'m first storing the row number of all the values present in the grid.\n- val[i] - represents a vector which stores the row indices of the value i.\n\n**Recursion**\n- Function Purpose: f(num,...
1
0
['C++']
1
select-cells-in-grid-with-maximum-score
Observational DP
observational-dp-by-sameonall-zcpu
Intuition\n Describe your first thoughts on how to solve this problem. \nU should observe that optimal answer is strictly decreasing sequence\n# Approach\n Desc
sameonall
NORMAL
2024-09-01T06:18:09.453258+00:00
2024-09-02T10:35:24.553731+00:00
246
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nU should observe that optimal answer is strictly decreasing sequence\n# Approach\n<!-- Describe your approach to solving the problem. -->\nwe will fact that "optimal answer is strictly decreasing sequence"\nto optimise dp[mask showing pre...
1
0
['Binary Search', 'Dynamic Programming', 'Sorting', 'Bitmask', 'C++']
1
select-cells-in-grid-with-maximum-score
✅ Java Solution
java-solution-by-harsh__005-owaz
CODE\nJava []\nclass Solution {\n int res;\n private void solve(List<List<Integer>> grid, int i, int total, boolean[] vis, int size) {\n if(total +
Harsh__005
NORMAL
2024-09-01T06:01:51.517505+00:00
2024-09-01T06:02:30.545015+00:00
131
false
## **CODE**\n```Java []\nclass Solution {\n int res;\n private void solve(List<List<Integer>> grid, int i, int total, boolean[] vis, int size) {\n if(total + (size - i) * (200 - (size - i - 1)) / 2 < res) return;\n \n if(i == size) {\n res = Math.max(res, total);\n retur...
1
0
['Java']
2
select-cells-in-grid-with-maximum-score
C++ DFS dp memo
c-dfs-dp-memo-by-user5976fh-a1qu
Could not solve this during the contest :(\n\nclass Solution {\npublic:\n vector<vector<int>> dp;\n vector<vector<int>> nums;\n int maxScore(vector<vec
user5976fh
NORMAL
2024-09-01T04:33:22.140545+00:00
2024-09-01T04:40:15.487285+00:00
203
false
Could not solve this during the contest :(\n```\nclass Solution {\npublic:\n vector<vector<int>> dp;\n vector<vector<int>> nums;\n int maxScore(vector<vector<int>>& g) {\n nums.resize(101);\n for (int i = 0; i < g.size(); ++i)\n for (int y = 0; y < g[0].size(); ++y)\n nu...
1
0
['C++']
0
select-cells-in-grid-with-maximum-score
Beats 100 % user in Python : Checkout the only one Quality code :
beats-100-user-in-python-checkout-the-on-4gnc
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
progammersoumen
NORMAL
2024-09-01T04:11:11.239909+00:00
2024-09-01T04:11:11.239926+00:00
118
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
select-cells-in-grid-with-maximum-score
Python heap 🔥🔥
python-heap-by-chitraksh24-0bgc
DP TLE\npython3 []\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n memo = {}\n grid = [[i for i in range(1,11)] for j in
chitraksh24
NORMAL
2024-09-01T04:05:14.926717+00:00
2024-09-01T04:05:14.926740+00:00
121
false
# DP TLE\n```python3 []\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n memo = {}\n grid = [[i for i in range(1,11)] for j in range(10)]\n grid = [sorted(list(set(grid[i])),reverse=True) for i in range(len(grid))]\n def solve(curr,taken):\n strpath = str(...
1
0
['Heap (Priority Queue)', 'Python3']
0
select-cells-in-grid-with-maximum-score
🔢 Maximum Score Selection in Grid with Unique Value Constraints 🧮
maximum-score-selection-in-grid-with-uni-eky3
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem involves selecting cells from a grid in such a way that the sum of selected
nikhil16kulkarni
NORMAL
2024-09-01T04:05:04.016939+00:00
2024-09-01T04:05:04.016965+00:00
244
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem involves selecting cells from a grid in such a way that the sum of selected cell values is maximized. The selection rules are:\n- No two selected cells can be from the same row.\n- The values in the selected cells must be uniq...
1
0
['Hash Table', 'Dynamic Programming', 'Python3']
0
select-cells-in-grid-with-maximum-score
◈ Python ◈ DP
python-dp-by-zurcalled_suruat-ljz1
Glossary: grid[i][j]: The element at thei-th row andj-th column of the input grid, representing a positive integer value. N_ROWS,N_COLS: The number of rows and
zurcalled_suruat
NORMAL
2025-02-21T19:23:11.659524+00:00
2025-02-21T19:23:11.659524+00:00
7
false
Glossary: - $grid[i][j]$: The element at the $i$-th row and $j$-th column of the input grid, representing a positive integer value. - $N\_ROWS$, $N\_COLS$: The number of rows and columns in the grid, respectively. - $ix\_vals\_chosen$: A tuple representing the values chosen so far (Approach 1). - $min\_next\_ix\_row$:...
0
0
['Dynamic Programming', 'Recursion', 'Memoization', 'Python3']
0
select-cells-in-grid-with-maximum-score
Stimulated analing 2
stimulated-analing-2-by-rajeeesh-eair
IntuitionApproachComplexity Time complexity: constant time complexity Space complexity: O(1) Code
rajeeesh
NORMAL
2025-02-17T01:18:30.811928+00:00
2025-02-17T01:18:30.811928+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: constant time complexity <!-- Add your time complexity here, e.g. $$O(n)$$ --> - Space complexity: O(1) <!-- Add your space complexity her...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
💥💥 Beats 100% on runtime and memory [EXPLAINED]
beats-100-on-runtime-and-memory-explaine-j6ed
IntuitionMaximize the score by selecting grid cells based on certain constraints. We need to consider both the row and column positions to avoid revisiting rows
r9n
NORMAL
2025-02-06T06:32:06.993294+00:00
2025-02-06T06:32:06.993294+00:00
4
false
# Intuition Maximize the score by selecting grid cells based on certain constraints. We need to consider both the row and column positions to avoid revisiting rows. The solution involves using dynamic programming to efficiently calculate the best score by recursively checking all possibilities, while ensuring no row is...
0
0
['Divide and Conquer', 'Dynamic Programming', 'Bit Manipulation', 'Depth-First Search', 'Graph', 'Memoization', 'Heap (Priority Queue)', 'Shortest Path', 'Bitmask', 'Kotlin']
0
select-cells-in-grid-with-maximum-score
DP || bitmasking || C++.
dp-bitmasking-c-by-rishiinsane-a5gw
IntuitionWe need to select numbers from a 2D grid such that no two numbers come from the same row, and each number in the selected set is unique. The goal is to
RishiINSANE
NORMAL
2025-02-01T10:13:37.600414+00:00
2025-02-01T10:13:37.600414+00:00
5
false
# Intuition We need to select numbers from a 2D grid such that no two numbers come from the same row, and each number in the selected set is unique. The goal is to maximize the sum of selected numbers. Using recursive strategy with bitmasking, where the state of each row (whether a number from that row has been used or...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
Miguel Gargallo 3276. Select Cells in Grid With Maximum Score
miguel-gargallo-3276-select-cells-in-gri-y2y9
IntuitionWe want to pick exactly one value from some (or all) rows in such a way that: No two selected cells come from the same row. All selected values are dis
miguelgargallo
NORMAL
2025-01-20T22:55:09.366278+00:00
2025-01-20T22:55:09.366278+00:00
2
false
# Intuition We want to pick exactly one value from some (or all) rows in such a way that: 1. No two selected cells come from the same row. 2. All selected values are distinct. 3. The sum of these values is maximized. Since every number in the grid is a positive integer, and we can have at most 10 rows, our pr...
0
0
['Python']
0
select-cells-in-grid-with-maximum-score
Explained: Hungarian Algorithm (quazi) schema for Bi-Graph
explained-hungarian-algorithm-quazi-sche-vv64
IntuitionLeverage a greedy approach that maximizes the total score.ApproachThe solution employs a bipartite graph matching algorithm with the following key step
ivangnilomedov
NORMAL
2024-12-13T20:30:09.315777+00:00
2024-12-13T20:30:09.315777+00:00
7
false
# Intuition\nLeverage a greedy approach that maximizes the total score.\n\n# Approach\nThe solution employs a bipartite graph matching algorithm with the following key steps:\n\n1. Greedy Value Selection\n - Process values from highest to lowest\n - Proves optimal because at each step, including the maximum availab...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
C++
c-by-harshaljain200028march-farb
\nunordered_map<int,unordered_map<string,int>> dp;\n int getMaxScore(auto curItr ,auto &end , string &visitedHash){\n \n int maxScore = 0;\n
harshaljain200028march
NORMAL
2024-12-05T10:57:31.751324+00:00
2024-12-05T10:57:50.383149+00:00
3
false
```\nunordered_map<int,unordered_map<string,int>> dp;\n int getMaxScore(auto curItr ,auto &end , string &visitedHash){\n \n int maxScore = 0;\n if(curItr!=end){ \n int key = curItr->first;\n if(dp.find(key)!=dp.end() && dp[key].find(visitedHash)!=dp[key].end())\n ...
0
0
[]
0
select-cells-in-grid-with-maximum-score
Simple and Easy JAVA Solution , using Memoization , invert the question and solve
simple-and-easy-java-solution-using-memo-gz88
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
Triyaambak
NORMAL
2024-10-24T10:00:24.052612+00:00
2024-10-24T10:01:49.237071+00:00
12
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
select-cells-in-grid-with-maximum-score
Bitmask || Binary Search || Upper_bound || Take - Not take
bitmask-binary-search-upper_bound-take-n-xuyl
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
krishan_vach
NORMAL
2024-10-11T21:05:48.508683+00:00
2024-10-11T21:05:48.508715+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
['Array', 'Binary Search', 'Dynamic Programming', 'Bit Manipulation', 'Matrix', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Java | Solution
java-solution-by-keshavkr_codderboy-o0xl
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
Keshavkr_codderboy
NORMAL
2024-10-09T05:54:11.105288+00:00
2024-10-09T05:54:11.105328+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
['Java']
0
select-cells-in-grid-with-maximum-score
Dynamic Programming with Bitmask Optimization
dynamic-programming-with-bitmask-optimiz-mnxz
\n\n# Approach\n Describe your approach to solving the problem. \n1. Value Grouping:\n - Create a Map (vals) where each key is a unique value from the grid, a
acailic
NORMAL
2024-10-02T14:54:17.089833+00:00
2024-10-02T14:54:17.089866+00:00
5
false
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. **Value Grouping**:\n - Create a `Map` (`vals`) where each key is a unique value from the grid, and the value is an array of row indices where this value appears.\n - Ensures each unique value is considered only once.\n\n2. **Sorting**:\n ...
0
0
['Dynamic Programming', 'Greedy', 'Memoization', 'Bitmask', 'TypeScript']
0
select-cells-in-grid-with-maximum-score
DP with bitmask | C++ | Image explanation
dp-with-bitmask-c-image-explanation-by-s-8cjz
DP with Bitmask. \n\n1. For each number, create mask of which row.\n2. Start with mask as 0 and go till all rows are considered by checking base condition.\n \n
soham17041998
NORMAL
2024-09-25T04:11:53.575762+00:00
2024-09-25T04:11:53.575798+00:00
14
false
DP with Bitmask. \n\n1. For each number, create mask of which row.\n2. Start with mask as 0 and go till all rows are considered by checking base condition.\n ```\n if(mask == (1 << n) - 1) {\n return 0;\n }\n```\n\n\nNow refer image for bit masking.\n\n![Screenshot 2024-09-25 094046.png](https://asset...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
IMAGINE IN SORTED 1D ARRAY | EASY BIT-MASKING | C++
imagine-in-sorted-1d-array-easy-bit-mask-jw6z
Approach\nSo this one is a tricky one. Brute force suggests to try all possibilities on rows and maintain uniqueness through sets, which results in tle.\n\nTry
rishi_058
NORMAL
2024-09-13T04:46:02.071419+00:00
2024-09-13T04:46:02.071447+00:00
10
false
# Approach\nSo this one is a tricky one. Brute force suggests to try all possibilities on rows and maintain uniqueness through sets, which results in tle.\n\nTry Imagining the problem for 1D Array, where you have to select some elements which are unique.\n\nFor that you can sort the array & use pick/not-pick.\n\nTo kee...
0
0
['Array', 'Divide and Conquer', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'C', 'Matrix', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
JAVA
java-by-abhiguptanitb-slln
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
abhiguptanitb
NORMAL
2024-09-09T01:26:07.544071+00:00
2024-09-09T01:26:07.544100+00:00
2
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
Simple explanation and simple code C++
simple-explanation-and-simple-code-c-by-py9u3
Intuition\n Describe your first thoughts on how to solve this problem. \nSince naive solution gives TLE, think of interchanging the way we keep the unique value
dee24da
NORMAL
2024-09-08T02:22:52.129278+00:00
2024-09-08T02:22:52.129309+00:00
20
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSince naive solution gives TLE, think of interchanging the way we keep the unique values and unique rows. Meaning go over values one by one and to maintain unique rows store the already used rows using some data structure.\n\n# Approach\n...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
DP + bitmask
dp-bitmask-by-rajdeep_nagar-ckm5
```\n/\n\n1010 matrix\n\n\nfrom ecah row we will select atmost one no.\n\n\nso we will keep track of no. selected from each row, so that we will not select the
Rajdeep_Nagar
NORMAL
2024-09-07T12:35:24.217007+00:00
2024-09-07T12:35:24.217036+00:00
1
false
```\n/*\n\n10*10 matrix\n\n\nfrom ecah row we will select atmost one no.\n\n\nso we will keep track of no. selected from each row, so that we will not select the same no. in upcoming row\n\nobviously we will select atmost 10 no\'s\n\n\nas grid[i][j]<=100, we can\'t use bitmask to keep track of selected no\'s\n\n\nREVER...
0
0
['Bitmask']
0
select-cells-in-grid-with-maximum-score
Backtracking with pruning
backtracking-with-pruning-by-dhairyaseth-5uae
Intuition\n Describe your first thoughts on how to solve this problem. \nThe requirement to have an element from every row implies that there has to be atleast
dhairyaseth
NORMAL
2024-09-06T22:06:30.267075+00:00
2024-09-06T22:06:30.267104+00:00
31
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe requirement to have an element from every row implies that there has to be atleast 1 unique element per row, and if that element has to be selected from that row it can\'t be selected from another row.\nWith the above condition in min...
0
0
['Backtracking', 'Recursion', 'Java']
0
select-cells-in-grid-with-maximum-score
DP + bitmask | skip element or take it while maintaining masking of row id
dp-bitmask-skip-element-or-take-it-while-8bkg
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
garvit_17
NORMAL
2024-09-06T18:38:26.795961+00:00
2024-09-06T18:38:26.796022+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
['C++']
0
select-cells-in-grid-with-maximum-score
✅💯🎊Simple C++ Code🎊🎊 || ✔Easy to understand🎯 || Easy Logic || Beginner friendly || Beats 100%
simple-c-code-easy-to-understand-easy-lo-5xy7
Intuition\n Describe your first thoughts on how to solve this problem. \nthere are total 10 rows, it means we can take a bit of number 2 ke power 10 = number 10
ritiwij
NORMAL
2024-09-06T17:01:43.146373+00:00
2024-09-06T17:01:43.146405+00:00
8
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nthere are total 10 rows, it means we can take a bit of number 2 ke power 10 = number 1024;\nmene vector v banaya hu jo har element ko store kar rha hai woh row me hai ,\nthen humne number ka limit diya tha number maximum 100 tak ja sakta ...
0
0
['Dynamic Programming', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
DP With Bitmask
dp-with-bitmask-by-avatar_027-85at
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
Avatar_027
NORMAL
2024-09-06T06:32:50.259316+00:00
2024-09-06T06:32:50.259340+00:00
11
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
select-cells-in-grid-with-maximum-score
Python3 Easy Solution
python3-easy-solution-by-pranaythangelll-kmu7
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
PranayThangelllapalli
NORMAL
2024-09-05T10:33:35.721931+00:00
2024-09-05T10:33:35.721964+00:00
15
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
['Dynamic Programming', 'Sorting', 'Python3']
0
select-cells-in-grid-with-maximum-score
DP Bitmask
dp-bitmask-by-harsha3330-cmow
Intuition\n Describe your first thoughts on how to solve this problem. \nWe are going to convert this 2d array into a 1d and write a dp solutions , this convert
Harsha3330
NORMAL
2024-09-04T16:12:02.706210+00:00
2024-09-04T16:12:02.706254+00:00
9
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe are going to convert this 2d array into a 1d and write a dp solutions , this convertion makes the array sorted and unique values will be clubed \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nDP bitmask \nLet u...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
why backtracking is not working ? can you guys help me ?
why-backtracking-is-not-working-can-you-jjkpl
\nclass Solution {\npublic:\n int solve(vector<vector<int>> grid, int r, vector<int>&freq){\n\n\tint n = grid.size();\n\tint m = grid[0].size();\n\tint ans =
parthkamal
NORMAL
2024-09-04T09:46:11.876158+00:00
2024-09-04T09:46:11.876194+00:00
7
false
```\nclass Solution {\npublic:\n int solve(vector<vector<int>> grid, int r, vector<int>&freq){\n\n\tint n = grid.size();\n\tint m = grid[0].size();\n\tint ans = 0;\n\tif(r == n)\n\t\treturn ans;\n bool flag = 0; \n\tfor (int j = 0; j < m; j++)\n\t{\n\t\tif(freq[grid[r][j]]==0){\n\t\t\tfreq[grid[r][j]]++;\n\t\t\ta...
0
0
[]
1
select-cells-in-grid-with-maximum-score
Simple Solution Explained in Deep | C++ | Beats 87.33% | DP
simple-solution-explained-in-deep-c-beat-vs53
\n\n\n# Intuition\nSimilar to graphs we will map elements to the rows they are present in and iterate from max value to lowest while marking the rows they were
AKSKL
NORMAL
2024-09-04T06:15:21.786292+00:00
2024-09-04T06:15:21.786320+00:00
2
false
![image.png](https://assets.leetcode.com/users/images/2c2b9fe5-1409-4ef8-b057-b0e35209c90f_1725430255.5268874.png)\n\n\n# Intuition\nSimilar to graphs we will map elements to the rows they are present in and iterate from max value to lowest while marking the rows they were in.\n\n# Approach\nFirst we will have a set of...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
Select Cells in Grid With Maximum Score
select-cells-in-grid-with-maximum-score-my6tb
Code\ncpp []\n#include <vector>\n#include <unordered_set>\n#include <algorithm>\n#include <cstring>\n\nclass Solution {\npublic:\n int dp[1025][101];\n \n
20250411.cid470
NORMAL
2024-09-04T06:03:54.416003+00:00
2024-09-04T06:03:54.416035+00:00
17
false
# Code\n```cpp []\n#include <vector>\n#include <unordered_set>\n#include <algorithm>\n#include <cstring>\n\nclass Solution {\npublic:\n int dp[1025][101];\n \n int maxScore(std::vector<std::vector<int>>& grid) {\n std::unordered_set<int> uniqueValues;\n std::vector<int> arr[101];\n\n for (...
0
0
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Matrix', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
4ms dp solution
4ms-dp-solution-by-sovlynn-pkqn
\n\n# Intuition\nSort the cells according to there value. Then for each value segments, update the dp array according to the result of previous segment to ensur
sovlynn
NORMAL
2024-09-04T02:37:32.123949+00:00
2024-09-04T02:37:32.123986+00:00
15
false
![image.png](https://assets.leetcode.com/users/images/e25c0d36-07d1-44bd-9254-46c389550c0f_1725417266.9803193.png)\n\n# Intuition\nSort the cells according to there value. Then for each value segments, update the dp array according to the result of previous segment to ensure the selected number not duplicate.\n\n# Comp...
0
0
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Matrix', 'Bitmask', 'Rust']
0
select-cells-in-grid-with-maximum-score
BACKTRACKING
backtracking-by-quietmorning2-2pag
Intuition\n Describe your first thoughts on how to solve this problem. \nFind the maximum value. If the maximum appears in multiple rows, iterate these rows and
QuietMorning2
NORMAL
2024-09-04T01:59:11.366467+00:00
2024-09-04T01:59:11.366489+00:00
9
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFind the maximum value. If the maximum appears in multiple rows, iterate these rows and use backtracking to find the answer for remaining rows.\n\n# Code\n```python3 []\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> in...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
Python3 (using dynamic programming)
python3-using-dynamic-programming-by-rey-kopa
\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int: \n @cache\n def helper(idx, seen):\n if idx == l: \n
reynaldocv
NORMAL
2024-09-03T21:13:42.542560+00:00
2024-09-03T21:13:42.542587+00:00
0
false
```\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int: \n @cache\n def helper(idx, seen):\n if idx == l: \n return 0 \n \n else: \n ans = 0\n \n for i in range(idx, l):\n ...
0
0
[]
0
select-cells-in-grid-with-maximum-score
Blazing Fast 🔥 5ms | Beats 100% | Rundown + Bitmask + Memo
blazing-fast-5ms-beats-100-rundown-bitma-3ao7
Intuition\n Describe your first thoughts on how to solve this problem. \nThe most straightforward approach, i.e. backtracking can quickly get very expensive for
swanandcode
NORMAL
2024-09-03T13:28:22.481408+00:00
2024-09-08T12:49:08.696477+00:00
17
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe most straightforward approach, i.e. **backtracking** can quickly get very expensive for some cases, hence this is one of those cases where you have to look at the data constraints.\n\n# Approach\n<!-- Describe your approach to solving...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
DP Solution using Bitmask
dp-solution-using-bitmask-by-ak3177590-bzv6
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
ak3177590
NORMAL
2024-09-03T05:29:38.048237+00:00
2024-09-03T05:29:38.048314+00:00
7
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*2^n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n*m*2^n)\n<!-- Add your space complexity he...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
Bitmasking + DP
bitmasking-dp-by-shyam-vishwakarma-8h2h
Intuition\nThe goal is to maximize the sum of selected cells in the grid, ensuring no two selected cells are from the same row and all selected values are uniqu
Shyam-Vishwakarma
NORMAL
2024-09-03T04:36:28.838553+00:00
2024-09-03T04:36:28.838587+00:00
10
false
# Intuition\nThe goal is to maximize the sum of selected cells in the grid, ensuring no two selected cells are from the same row and all selected values are unique.\n\n# Approach\n- Mapping Numbers to Rows: Create a mapping of each unique number in the grid to the rows in which it appears.\n- Bitmasking: Represent the ...
0
0
['Dynamic Programming', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Best first
best-first-by-kamanashisroy-2fuz
Intuition\nWe can reduce our time-complexity by best-first search approach.\nTo find the best, we sort all the rows in non-increasing order.\n\n# Approach\nNow
kamanashisroy
NORMAL
2024-09-03T00:04:46.254008+00:00
2024-09-03T00:04:46.254032+00:00
8
false
# Intuition\nWe can reduce our time-complexity by best-first search approach.\nTo find the best, we sort all the rows in non-increasing order.\n\n# Approach\nNow in an recursive manner we explore the biggest value in each row at first. With that we can quickly get the best result.\n\nWe can compare with existing best t...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
DP C++
dp-c-by-intermsof-stkj
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
intermsof
NORMAL
2024-09-02T22:54:28.276307+00:00
2024-09-02T22:54:28.276340+00:00
9
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
select-cells-in-grid-with-maximum-score
Unique Maximum Values with Memoization
unique-maximum-values-with-memoization-b-gebn
Intuition\n Describe your first thoughts on how to solve this problem. \nThe most straightforward approach, i.e. backtracking can quickly get very expensive for
swanandcode
NORMAL
2024-09-02T22:04:02.251557+00:00
2024-09-08T12:48:15.398857+00:00
14
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe most straightforward approach, i.e. **backtracking** can quickly get very expensive for some cases, hence this is one of those cases where you have to look at the data constraints.\n\n# Approach\n<!-- Describe your approach to solving...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
DP C++
dp-c-by-max_dong-4yu7
3276. Select Cells in Grid With Maximum Score\n\n### Description\n\nYou are given a 2D matrix grid consisting of positive integers.\n\nYou have to select one or
Max_Dong
NORMAL
2024-09-02T19:15:50.644284+00:00
2024-09-02T19:15:50.644311+00:00
4
false
# [3276. Select Cells in Grid With Maximum Score](https://leetcode.com/problems/select-cells-in-grid-with-maximum-score/)\n\n### Description\n\nYou are given a 2D matrix `grid` consisting of positive integers.\n\nYou have to select *one or more* cells from the matrix such that the following conditions are satisfied:\n\...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
(JAVA) Top-down DP WITHOUT bitmasking
java-top-down-dp-without-bitmasking-by-a-c0uu
Intuition\nI am doing it just for fun. It is exactly the same except that we are using a string to represent all the rows from which we have already selected a
a068864
NORMAL
2024-09-02T18:21:41.964864+00:00
2024-09-02T18:21:41.964881+00:00
19
false
# Intuition\nI am doing it just for fun. It is exactly the same except that we are using a string to represent all the rows from which we have already selected a cell so far.\n\n# Approach\nNotice that this problem has overlapping sub-problems and optimal sub-structure so we can try recursion with memo. \n\n# Complexit...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
DP+Bitmasking easy recursive solution
dpbitmasking-easy-recursive-solution-by-78qgi
\n\n# Approach\nDP + Bitmasking\n\n\n\n# Code\ncpp []\nclass Solution {\n\npublic:\n\n int dp[1025][101];\n int solve(int ix,int mask,int n,vector<int> &t
soumya_24
NORMAL
2024-09-02T16:56:56.920909+00:00
2024-09-02T16:56:56.920941+00:00
4
false
\n\n# Approach\nDP + Bitmasking\n\n\n\n# Code\n```cpp []\nclass Solution {\n\npublic:\n\n int dp[1025][101];\n int solve(int ix,int mask,int n,vector<int> &temp,vector<int> arr[]){\n if(ix==n){\n return 0;\n }\n if(dp[mask][ix]!=-1) return dp[mask][ix];\n int ans=0;\n ...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
Beats 100%,
beats-100-by-shreya_radha_14-gc60
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
shreya_radha_14
NORMAL
2024-09-02T15:48:25.528743+00:00
2024-09-02T15:48:25.528779+00:00
26
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(2^N \u2217 N)\n\n\n\n\n- Space complexity:\n<!-- Add your space complexit...
0
0
['JavaScript']
0
select-cells-in-grid-with-maximum-score
[Swift] Sort descending + DFS
swift-sort-descending-dfs-by-dibbleme-g1r4
Intuition\nIterate the grid and record all unqiue value and its row index data into an array of turple: [(Int, [Int])], sorted it in desending order, and DFS th
dibbleme
NORMAL
2024-09-02T15:14:04.157941+00:00
2024-09-02T15:15:02.298425+00:00
8
false
# Intuition\nIterate the grid and record all unqiue `value` and its `row index` data into an array of turple: `[(Int, [Int])]`, sorted it in desending order, and DFS this array, in each DFS operation, iterate all rows that has NOT been visited, and record the max score.\n\nFor example,\nInput:`grid = [[1,2,3],[4,3,2],[...
0
0
['Swift']
0
select-cells-in-grid-with-maximum-score
Dp with Bitmasking || Bit Manipulation || Recursion || C++
dp-with-bitmasking-bit-manipulation-recu-vb56
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
oreocraz_273
NORMAL
2024-09-02T13:59:23.639655+00:00
2024-09-02T13:59:23.639692+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
['Dynamic Programming', 'Recursion', 'Bitmask', 'C++']
0
select-cells-in-grid-with-maximum-score
Trying to be Beginner-Friendly
trying-to-be-beginner-friendly-by-dinoza-8bfm
Intuition\n Describe your first thoughts on how to solve this problem. \nCould be done with normal recursion where the constraint look like normal recursion wou
dinozambas
NORMAL
2024-09-02T13:07:33.129712+00:00
2024-09-02T13:09:26.976581+00:00
38
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nCould be done with normal recursion where the constraint look like normal recursion would work. If you solve with normal recursion you are going to get a TLE, which would make you think "Oh, we just need a dp" and take the changing parame...
0
0
['Dynamic Programming', 'Bitmask', 'Java']
0
select-cells-in-grid-with-maximum-score
DP with a little bit greedy
dp-with-a-little-bit-greedy-by-fredrick_-t8hc
Intuition\n Describe your first thoughts on how to solve this problem. \nThe problem is essentially about selecting cells from the matrix with the constraints t
Fredrick_LI
NORMAL
2024-09-02T09:44:30.506082+00:00
2024-09-02T09:44:30.506109+00:00
12
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe problem is essentially about selecting cells from the matrix with the constraints that no two selected cells are from the same row and that all selected values are unique. To maximize the sum of selected values, we can use dynamic pro...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
brute force dp on doubly sorted grid
brute-force-dp-on-doubly-sorted-grid-by-x7w2u
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
vitanova
NORMAL
2024-09-02T09:42:18.499684+00:00
2024-09-02T09:42:18.499707+00:00
11
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
['Dynamic Programming', 'Sorting', 'Python3']
0
select-cells-in-grid-with-maximum-score
Easy Java Solution
easy-java-solution-by-danish_jamil-5nax
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
Danish_Jamil
NORMAL
2024-09-02T08:24:23.853929+00:00
2024-09-02T08:24:23.853960+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
select-cells-in-grid-with-maximum-score
Simple Explanation + intuition, w/ Handwritten color-coded drawings and notes.
simple-explanation-intuition-w-handwritt-69hb
Intuition\n Describe your first thoughts on how to solve this problem. \n\nFULL PDF OF ALL HANDWRITTEN NOTES CAN BE FOUND HERE: https://drive.google.com/file/d/
thelinuxman
NORMAL
2024-09-02T07:12:57.637696+00:00
2024-09-02T07:12:57.637723+00:00
1
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n**FULL PDF OF ALL HANDWRITTEN NOTES CAN BE FOUND HERE:** https://drive.google.com/file/d/1Sw1p2ScKndGBbUixW6T4SScUPiWBNj99/view?usp=sharing\n\n- Initially, upon seeing this problem, it\'s immediately obvious that a decision tree can be ...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
Go Solution
go-solution-by-hjrand1005-jccy
golang []\nfunc maxScore(grid [][]int) int {\n n := len(grid)\n m := len(grid[0])\n\n graph := make(map[int][]int)\n values := make([]int, 0)\n s
hjrand1005
NORMAL
2024-09-02T06:15:06.555988+00:00
2024-09-02T06:15:06.556018+00:00
3
false
```golang []\nfunc maxScore(grid [][]int) int {\n n := len(grid)\n m := len(grid[0])\n\n graph := make(map[int][]int)\n values := make([]int, 0)\n seen := make(map[int]struct{})\n\n for i := 0; i < n; i++ {\n for j := 0; j < m; j++ {\n val := grid[i][j]\n graph[val] = appe...
0
0
['Go']
0
select-cells-in-grid-with-maximum-score
DP Solution with using bit mask for checking visited row
dp-solution-with-using-bit-mask-for-chec-8kft
Intuition\n Describe your first thoughts on how to solve this problem. \nLike value is more, which will increase the time complexity so we go with storing visit
anshul__singh
NORMAL
2024-09-02T05:04:52.496839+00:00
2024-09-02T05:04:52.496868+00:00
7
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nLike value is more, which will increase the time complexity so we go with storing visited row.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here,...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
Kotlin | 100% (no competition) | explained
kotlin-100-no-competition-explained-by-j-g5kp
This is an interesting problem because it looks easy! My initial solution didn\'t take the rows into account, and so got the wrong answer. I then used a prior
janinbv
NORMAL
2024-09-02T03:19:47.766496+00:00
2024-09-02T03:20:21.253263+00:00
9
false
This is an interesting problem because it looks easy! My initial solution didn\'t take the rows into account, and so got the wrong answer. I then used a priority queue, but that did not work with the recursion. So here I will describe my final solution. It could probably be made more efficient if memorization is ad...
0
0
['Array', 'Backtracking', 'Recursion', 'Sorting', 'Kotlin']
0
select-cells-in-grid-with-maximum-score
Hall's Marriage Theorem (Beats 100% Time and Memory Complexity)
halls-marriage-theorem-beats-100-time-an-g80a
Approach\nFor each unique value, find out the set of rows it\'s located on (we can store using this bitmask; here I save it in the pos array). \n\nNow model the
donbasta
NORMAL
2024-09-02T03:17:56.334023+00:00
2024-09-02T03:17:56.334066+00:00
22
false
# Approach\nFor each unique value, find out the set of rows it\'s located on (we can store using this bitmask; here I save it in the `pos` array). \n\nNow model the problem as a bipartite graph, the left one containing the values, and the right one containing the rows. We connect two vertices `(v, r)` if the value `v` ...
0
0
['C++']
0
select-cells-in-grid-with-maximum-score
Beats 100% || Hungarian matching
beats-100-hungarian-matching-by-sanket_k-ui7q
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
sanket_kathrotiya
NORMAL
2024-09-02T03:01:30.121622+00:00
2024-09-02T03:01:30.121649+00:00
11
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
bitmask dp O(2**(m)*(numofvals))
bitmask-dp-o2mnumofvals-by-maxorgus-rckz
We have at most 100 unique values in the grid, so it is a good dp variable. Store the rows in which each value appears in a dictionary, and we loop over \'the s
MaxOrgus
NORMAL
2024-09-02T02:17:51.981285+00:00
2024-09-02T02:17:51.981306+00:00
6
false
We have at most 100 unique values in the grid, so it is a good dp variable. Store the rows in which each value appears in a dictionary, and we loop over \'the smallest value below which all numbers we have taken\' in the dp.\n\nThe other variable in the dp is a bit mask for the rows already used, which is at most 2^10 ...
0
0
['Dynamic Programming', 'Bitmask', 'Python3']
0
select-cells-in-grid-with-maximum-score
Python DP, easy to understand with comments
python-dp-easy-to-understand-with-commen-wqer
\n\n# Code\npython3 []\nimport collections\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n n = len(grid)\n # DP goal: choose the r
roadytom
NORMAL
2024-09-01T20:48:01.606228+00:00
2024-09-01T20:48:01.606250+00:00
7
false
\n\n# Code\n```python3 []\nimport collections\nclass Solution:\n def maxScore(self, grid: List[List[int]]) -> int:\n n = len(grid)\n # DP goal: choose the row that equals to given number, so it makes score max\n memo = [[-1] * (1<<n) for _ in range(101)]\n # number to row (to easily find all rows with this...
0
0
['Python3']
0
select-cells-in-grid-with-maximum-score
Simple dp solution
simple-dp-solution-by-risabhuchiha-5rwl
\njava []\nclass Solution {\n Integer[][]dp=new Integer[101][1024];\n int rr;\n int cc;\n public int maxScore(List<List<Integer>> grid) {\n rr
risabhuchiha
NORMAL
2024-09-01T20:20:58.016861+00:00
2024-09-01T20:20:58.016886+00:00
16
false
\n```java []\nclass Solution {\n Integer[][]dp=new Integer[101][1024];\n int rr;\n int cc;\n public int maxScore(List<List<Integer>> grid) {\n rr=grid.size();\n cc=grid.get(0).size();\n \n\n return f(1,0,grid);\n }\n public int f(int val,int mask,List<List<Integer>> grid){\n ...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
simple bitmask dp
simple-bitmask-dp-by-titu02-nlle
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
Titu02
NORMAL
2024-09-01T19:20:57.883928+00:00
2024-09-01T19:20:57.883962+00:00
10
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
select-cells-in-grid-with-maximum-score
Bottom Up DP + BitMask || Clean Code || Beats 100% || JAVA
bottom-up-dp-bitmask-clean-code-beats-10-zucl
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
owaispatel95
NORMAL
2024-09-01T18:55:44.214755+00:00
2024-09-01T18:55:44.214792+00:00
10
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
select-cells-in-grid-with-maximum-score
Beats 100% of the Java users
beats-100-of-the-java-users-by-deeepakga-dcn1
Intuition\n1. Maximize the Score: The goal is to maximize the score by selecting rows such that the sum of selected values is the highest possible.\n\n2. Greedy
DeeepakGarg
NORMAL
2024-09-01T17:18:40.502172+00:00
2024-09-01T17:18:40.502199+00:00
20
false
# Intuition\n1. Maximize the Score: The goal is to maximize the score by selecting rows such that the sum of selected values is the highest possible.\n\n2. Greedy by Value: Start with the highest possible value and attempt to include rows where this value occurs. Use recursive exploration to find the optimal combinatio...
0
0
['Java']
0
select-cells-in-grid-with-maximum-score
[C++] Backtracking Solution
c-backtracking-solution-by-samuel3shin-uwz9
Code\ncpp []\nclass Solution {\npublic:\n int maxVal, n, m;\n unordered_map<string, int> memo;\n\n string createKey(int row, const set<int>& usedValues
Samuel3Shin
NORMAL
2024-09-01T17:16:36.434202+00:00
2024-09-01T17:16:36.434231+00:00
0
false
# Code\n```cpp []\nclass Solution {\npublic:\n int maxVal, n, m;\n unordered_map<string, int> memo;\n\n string createKey(int row, const set<int>& usedValues) {\n string key = to_string(row) + "|";\n for (int value : usedValues) {\n key += to_string(value) + ",";\n }\n ret...
0
0
['C++']
0
minimum-sum-of-four-digit-number-after-splitting-digits
C++ || easy solution || 0 ms
c-easy-solution-0-ms-by-darshil_1804-4p76
\nclass Solution{\npublic:\n int minimumSum(int num){\n string s = to_string(num);\n sort(s.begin(), s.end());\n int res = (s[0] - \'0\'
darshil_1804
NORMAL
2022-02-05T17:30:42.984719+00:00
2022-02-05T17:30:42.984764+00:00
12,701
false
```\nclass Solution{\npublic:\n int minimumSum(int num){\n string s = to_string(num);\n sort(s.begin(), s.end());\n int res = (s[0] - \'0\' + s[1] - \'0\') * 10 + s[2] - \'0\' + s[3] - \'0\';\n return res;\n }\n};\n```\nDo **Upvote** if you like the solution :)
110
3
['C', 'Sorting']
13
minimum-sum-of-four-digit-number-after-splitting-digits
Java | Straightforward
java-straightforward-by-aaveshk-a5qz
\nclass Solution\n{\n public int minimumSum(int num)\n {\n int[] dig = new int[4]; // For each digit\n int cur = 0;\n while(num > 0)
aaveshk
NORMAL
2022-02-05T16:00:59.319905+00:00
2022-03-16T04:44:42.920146+00:00
14,877
false
```\nclass Solution\n{\n public int minimumSum(int num)\n {\n int[] dig = new int[4]; // For each digit\n int cur = 0;\n while(num > 0) // Getting each digit\n {\n dig[cur++] = num % 10;\n num /= 10;\n }\n Arrays.sort(dig); // Ascending order\n ...
97
4
['Java']
19
minimum-sum-of-four-digit-number-after-splitting-digits
Python - simple & fast with explanation - no permutation
python-simple-fast-with-explanation-no-p-qizv
Please upvote if you like my solution. Let me know in the comments if you have any suggestions to increase performance or readability. \n\nNotice that:\n1. We d
fatamorgana
NORMAL
2022-02-05T16:01:49.416518+00:00
2022-02-05T21:17:44.011531+00:00
11,244
false
Please upvote if you like my solution. Let me know in the comments if you have any suggestions to increase performance or readability. \n\n**Notice** that:\n1. We do not need to generate all possible combinations of spliting the input into two numbers. In the ideal solution, num1 and num2 will always be of equal length...
70
0
['Python', 'Python3']
14
minimum-sum-of-four-digit-number-after-splitting-digits
C++ Sorting + Greedy
c-sorting-greedy-by-lzl124631x-7jeh
\n\nSee my latest update in repo LeetCode\n\n## Solution 1. Sorting + Greedy\n\nGet the 4 digits from n. Assume they are a <= b <= c <= d, the sum is minimum wh
lzl124631x
NORMAL
2022-02-05T16:01:20.515418+00:00
2022-05-25T04:36:12.500563+00:00
4,300
false
\n\nSee my latest update in repo [LeetCode](https://github.com/lzl124631x/LeetCode)\n\n## Solution 1. Sorting + Greedy\n\nGet the 4 digits from `n`. Assume they are `a <= b <= c <= d`, the sum is minimum when `new1 = ac` and `new2 = bd`.\n\nSo, the answer is `10 * (a + b) + (c + d)`.\n\n```cpp\n// OJ: https://leetcode....
27
2
[]
5
minimum-sum-of-four-digit-number-after-splitting-digits
[C++/java/C#] Two plus Two sorted || Straight forward Solutions
cjavac-two-plus-two-sorted-straight-forw-n86q
SolutionA 2/2 split produce small sums than 1/3 splits. The idea is to sort the digits in an order and then consume (1, 3) and (2, 4) combination and return the
nitishhsinghhh
NORMAL
2022-05-23T07:49:47.589253+00:00
2025-01-22T11:32:22.913828+00:00
1,052
false
# Solution A 2/2 split produce small sums than 1/3 splits. The idea is to sort the digits in an order and then consume (1, 3) and (2, 4) combination and return their result. ```cpp [] // Solution 1 class Solution { public: /* * Computes the minimum sum of two new numbers formed by rearranging the digits of th...
24
0
['Math', 'Greedy', 'Sorting', 'C++', 'Java', 'C#']
1
minimum-sum-of-four-digit-number-after-splitting-digits
🔥 [Python3] 2 line, simple sort and make pairs
python3-2-line-simple-sort-and-make-pair-f2q1
\nclass Solution:\n def minimumSum(self, num: int) -> int:\n d = sorted(str(num))\n return int(d[0] + d[2]) + int(d[1] + d[3])\n\n
yourick
NORMAL
2023-05-28T01:02:52.969599+00:00
2023-05-28T01:02:52.969629+00:00
2,391
false
```\nclass Solution:\n def minimumSum(self, num: int) -> int:\n d = sorted(str(num))\n return int(d[0] + d[2]) + int(d[1] + d[3])\n\n```
22
0
['Math', 'Python', 'Python3']
1
minimum-sum-of-four-digit-number-after-splitting-digits
Two and Two
two-and-two-by-votrubac-p71a
We should always do a 2/2 split. 1/3 splits produce large sums. \n\nSo, we pick two smallest digits to be in the decimal\'s place, and two largest - one\'s plac
votrubac
NORMAL
2022-02-05T18:15:13.726468+00:00
2022-02-05T19:44:50.150554+00:00
2,246
false
We should always do a 2/2 split. 1/3 splits produce large sums. \n\nSo, we pick two smallest digits to be in the decimal\'s place, and two largest - one\'s place. \n\n**C++**\n```cpp\nint minimumSum(int num) {\n auto s = to_string(num);\n nth_element(begin(s), begin(s) + 1, end(s));\n return (s[0] -\'0\' + s[1...
21
2
[]
6
minimum-sum-of-four-digit-number-after-splitting-digits
Easy Java
easy-java-by-sakhib-mz64
\nclass Solution {\n public int minimumSum(int num) {\n char[] ch=(num+"").toCharArray();\n Arrays.sort(ch);\n int n=Integer.parseInt(""
SakhiB
NORMAL
2022-04-24T09:59:19.243251+00:00
2022-04-24T09:59:19.243276+00:00
2,119
false
```\nclass Solution {\n public int minimumSum(int num) {\n char[] ch=(num+"").toCharArray();\n Arrays.sort(ch);\n int n=Integer.parseInt(""+ch[0]+ch[2]);\n int m=Integer.parseInt(""+ch[1]+ch[3]);\n return n+m;\n } \n}\n```
20
0
['Java']
3
minimum-sum-of-four-digit-number-after-splitting-digits
Simple C++ Solution | Beginner Friendly | 0ms | beats 100%
simple-c-solution-beginner-friendly-0ms-w663k
In order to find the the minimum sum, the best way to do it is by creating two two-digits numbers.\n(Or 1 digit numbers as leading zeros are allowed)\nThe reaso
jainpranjal_270
NORMAL
2022-02-05T17:43:11.649769+00:00
2022-02-05T18:01:56.144750+00:00
1,525
false
In order to find the the minimum sum, the best way to do it is by creating two two-digits numbers.\n(Or 1 digit numbers as leading zeros are allowed)\nThe reason for the same is pretty simple and straight forward. \nConsider the example : 9999\n9 + 999 = 1008\n99 + 99 = 198\n\n**Now while creating the two digits, in or...
17
0
['Math', 'C']
2
minimum-sum-of-four-digit-number-after-splitting-digits
Simple || 31 ms || Python || Beats 86% || Easy to understand
simple-31-ms-python-beats-86-easy-to-und-h4qw
\nclass Solution:\n def minimumSum(self, num: int) -> int:\n s = list(str(num))\n s.sort()\n s1 = s[0]+s[2]\n s2 = s[1]+s[3]\n
workingpayload
NORMAL
2022-04-13T21:01:49.078799+00:00
2022-04-13T21:01:49.078862+00:00
1,420
false
```\nclass Solution:\n def minimumSum(self, num: int) -> int:\n s = list(str(num))\n s.sort()\n s1 = s[0]+s[2]\n s2 = s[1]+s[3]\n sum = int(s1)+int(s2)\n \n return sum\n```\t\t
16
0
['Python']
2
minimum-sum-of-four-digit-number-after-splitting-digits
3 lines | java
3-lines-java-by-kanna17vce-j9wt
extract digits into array\n2. sort\n3. use first and 4th element to make one number and 2nd and 3rd to make another number and return the sum of the numbrs\n\n
kanna17vce
NORMAL
2022-02-05T16:11:12.659325+00:00
2022-02-05T16:13:11.045699+00:00
1,611
false
1. extract digits into array\n2. sort\n3. use first and 4th element to make one number and 2nd and 3rd to make another number and return the sum of the numbrs\n```\n public int minimumSum(int num) {\n int []a={ num%10,(num/10)%10,(num/100)%10 , (num/1000)%10};\n Arrays.sort(a);\n return a[0]*10+a[...
16
1
['Java']
5
minimum-sum-of-four-digit-number-after-splitting-digits
2 lines code in JS
2-lines-code-in-js-by-harsh1923-b0kr
\nvar minimumSum = function(num) {\n const temp=num.toString().split(\'\').sort();\nreturn (parseInt(temp[0]+temp[2])+parseInt(temp[1]+temp[3]));\n \n};\n
harsh1923
NORMAL
2022-08-01T18:50:00.472942+00:00
2022-08-01T18:50:00.472989+00:00
1,855
false
```\nvar minimumSum = function(num) {\n const temp=num.toString().split(\'\').sort();\nreturn (parseInt(temp[0]+temp[2])+parseInt(temp[1]+temp[3]));\n \n};\n```
13
0
['JavaScript']
1
minimum-sum-of-four-digit-number-after-splitting-digits
Easy, Detailed and Fast JAVA solution.
easy-detailed-and-fast-java-solution-by-1rodg
Intuition\n Describe your first thoughts on how to solve this problem. \n\nNow if there are two 2-digit numbers then it will have one at tens position and other
shreyatleetcode
NORMAL
2023-04-18T07:05:05.103503+00:00
2023-04-18T07:05:26.008398+00:00
1,472
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nNow if there are two 2-digit numbers then it will have one at tens position and other at unit position.\n\n 74 = 70 * 10 + 4 (7 is at tens digit and 4 is at unit digit.)\n\nNow, since we know that tens digit will have more impact o...
10
0
['Math', 'Sorting', 'Java']
2
minimum-sum-of-four-digit-number-after-splitting-digits
Magic Logic Marvellous Python3
magic-logic-marvellous-python3-by-ganjin-sn10
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
GANJINAVEEN
NORMAL
2023-03-04T19:37:11.355083+00:00
2023-03-04T19:37:11.355112+00:00
894
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)$$ --...
9
0
['Python3']
2
minimum-sum-of-four-digit-number-after-splitting-digits
[PYTHON 3] Easy Solution
python-3-easy-solution-by-omkarxpatel-p7mp
```py\nclass Solution:\n def minimumSum(self, num: int) -> int:\n s=list(str(num))\n s.sort()\n return int(s[0]+s[2])+int(s[1]+s[3])
omkarxpatel
NORMAL
2022-07-11T20:17:53.619416+00:00
2022-07-11T20:17:53.619462+00:00
1,243
false
```py\nclass Solution:\n def minimumSum(self, num: int) -> int:\n s=list(str(num))\n s.sort()\n return int(s[0]+s[2])+int(s[1]+s[3])
9
1
['Sorting', 'Python', 'Python3']
2
minimum-sum-of-four-digit-number-after-splitting-digits
Golang Solution with explanation
golang-solution-with-explanation-by-nath-hweb
How This Solution Works:\n\nThe idea of this solution is pretty simple and relies on the fact that the minimum number is made by making the biggest number the l
nathannaveen
NORMAL
2022-02-06T16:27:14.210465+00:00
2022-02-06T16:27:14.210491+00:00
461
false
## **How This Solution Works:**\n\nThe idea of this solution is pretty simple and relies on the fact that the minimum number is made by making the biggest number the last digit and the smallest number the first. For example: If we use the digits `[4, 6, 1, 3, 0, 9]`, the minimum number we can make is `013469`.\n\nIf we...
9
0
['Go']
0
minimum-sum-of-four-digit-number-after-splitting-digits
Faster than 94.61% PYTHON | EASY
faster-than-9461-python-easy-by-s22j10-294h
UPVOTE\n\n\ns=list(str(num))\n s.sort()\n return int(s[0]+s[2])+int(s[1]+s[3])\n\nTHANKS FOR VIEWING
s22j10
NORMAL
2022-04-16T04:20:48.133113+00:00
2022-04-16T04:20:48.133144+00:00
773
false
# UPVOTE\n\n```\ns=list(str(num))\n s.sort()\n return int(s[0]+s[2])+int(s[1]+s[3])\n```\n**THANKS FOR VIEWING**
8
0
['Python']
2
minimum-sum-of-four-digit-number-after-splitting-digits
Easy to Understand Pythonic solution
easy-to-understand-pythonic-solution-by-bq81i
Some of the solutions to this problem seemed to be not very easy to understand so here\'s my take:\n\n# Explanation:\nWe put all our digits in a list, sort them
mikael_p
NORMAL
2023-02-25T21:37:10.910458+00:00
2023-04-17T05:37:56.084528+00:00
483
false
*Some of the solutions to this problem seemed to be not very easy to understand so here\'s my take:*\n\n# **Explanation:**\nWe put all our digits in a list, sort them with a built-in method **sort()** (so that the numbers are sorted from smallest to highest), join 1st + 3d and 2nd+ 4th elements as string, cast into int...
7
0
['Python3']
0
minimum-sum-of-four-digit-number-after-splitting-digits
1 ms, 41mb, Java, Sorting
1-ms-41mb-java-sorting-by-sid_3945-v7j5
https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/submissions/\nThe logic is: take the 4 digit numbers and split the digits
sid_3945
NORMAL
2022-02-14T05:08:07.165275+00:00
2022-02-14T05:08:07.165319+00:00
707
false
https://leetcode.com/problems/minimum-sum-of-four-digit-number-after-splitting-digits/submissions/\nThe logic is: take the 4 digit numbers and split the digits and store in an array of size 4. Then sort the array. Objective is to make two numbers that are smallest (so that their sum is smallest). One way of doing this ...
7
0
['Sorting', 'Java']
0