-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
interview_prep/algorithm/java/ide_handicapped/set_matrix_zeroes/Solution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import java.util.Arrays; | ||
|
||
class Solution { | ||
public void setZeroes(int[][] m) { | ||
m[0][0] = 9999; | ||
} | ||
|
||
public static void main(String[] args) { | ||
Solution self = new Solution(); | ||
int[][] i1 = new int[][]{{0,1,2,0},{3,4,5,2},{1,3,1,5}}; | ||
int[][] o1 = new int[][]{{0,0,0,0},{0,4,5,0},{0,3,1,0}}; | ||
|
||
self.setZeroes(i1); | ||
|
||
assert Arrays.equals(i1, o1) == true; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
interview_prep/algorithm/java/ide_handicapped/string_to_integer_atoi/Solution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Solution { | ||
public int myAtoi(String s) { | ||
return -1; | ||
} | ||
|
||
public static void main(String[] args) { | ||
Solution self = new Solution(); | ||
assert self.myAtoi("42") == 42; | ||
assert self.myAtoi(" -42") == -42; | ||
assert self.myAtoi("4193 with words") == 4193; | ||
} | ||
} |