Home
MINJUN
Cancel

BOJ. Tomato (7569)

[Link] https://www.acmicpc.net/problem/7569 //Position < int i, int j, int k , int step> =====> Memory exceed!!! import java.util.*; import java.io.*; public class Main { static int ...

LeetCode. 37. Sudoku Solver

[Link] https://leetcode.com/problems/sudoku-solver/ class Solution { char[][] b; public void solveSudoku(char[][] board) { int len = board.length; b = board; so...

LeetCode. 36. Valid Sudoku

[Link] https://leetcode.com/problems/valid-sudoku/ class Solution { public boolean isValidSudoku(char[][] board) { HashSet<Character> hmRow = new HashSet<>(); H...

BOJ. Tell Median Value (1655)

[Link] https://www.acmicpc.net/problem/1655 import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new B...

LeetCode. 34. Find First and Last Position of Element in Sorted Array

[Link] https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ class Solution { public int[] searchRange(int[] nums, int target) { int lb = -1, hb = ...

LeetCode. 33. Search in Rotated Sorted Array

[Link] https://leetcode.com/problems/search-in-rotated-sorted-array/ class Solution { public int search(int[] nums, int target) { int l = 0, r = nums.length - 1, mid; while...

LeetCode. 32. Longest Valid Parentheses

[Link] https://leetcode.com/problems/longest-valid-parentheses/ class Solution { public int longestValidParentheses(String s) { Stack<Integer> stack = new Stack(); ch...

BOJ. Maximum heap (11279)

[Link] https://www.acmicpc.net/problem/11279 import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { Heap heap = new Heap(); ...

Codility. ArrayInversionCount

[Link] https://app.codility.com/programmers/trainings/4/array_inversion_count/ import java.util.*; class Solution { public int solution(int[] A) { ArrayList<Integer> list = ne...

LeetCode. 35. Search Insert Position

[Link] https://leetcode.com/problems/search-insert-position/ class Solution { public int searchInsert(int[] nums, int target) { int l = 0, r = nums.length - 1, mid; while(l...