Skip to content

Commit ff1cfb8

Browse files
add 2022
1 parent 4626e39 commit ff1cfb8

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|2022|[Convert 1D Array Into 2D Array](https://leetcode.com/problems/convert-1d-array-into-2d-array/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2022.java) ||Easy||
1112
|2018|[Check if Word Can Be Placed In Crossword](https://leetcode.com/problems/check-if-word-can-be-placed-in-crossword/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2018.java) ||Medium||
1213
|2017|[Grid Game](https://leetcode.com/problems/grid-game/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2017.java) ||Medium|Array, Matrix, Prefix Sum|
1314
|2016|[Maximum Difference Between Increasing Elements](https://leetcode.com/problems/maximum-difference-between-increasing-elements/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2016.java) ||Easy||
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2022 {
4+
public static class Solution1 {
5+
public int[][] construct2DArray(int[] original, int m, int n) {
6+
int size = original.length;
7+
if (m * n != size) {
8+
return new int[][]{};
9+
}
10+
int[][] ans = new int[m][n];
11+
int k = 0;
12+
for (int i = 0; i < m; i++) {
13+
for (int j = 0; j < n; j++) {
14+
ans[i][j] = original[k++];
15+
}
16+
}
17+
return ans;
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy