본문 바로가기

Programming107

[leetcode] RotateList https://leetcode.com/problems/rotate-list/ Rotate List - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import exam.ListNode; public class RotateList { public static void main(String[] args) { // Input: 1->2->3->4->5->NULL, k = 2 ListNode node5 = new ListNode(5); ListNode node4 = .. 2020. 11. 29.
[leetcode] RomanToInt https://leetcode.com/problems/roman-to-integer/ Roman to Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.TreeMap; public class RomanToInt { public static void main(String[] args) { System.out.println(romanToInt("MCDXCIII")); System.out.println(romanToInt(.. 2020. 11. 29.
[leetcode] PopulatingNextRightPointersinEachNode https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ Populating Next Right Pointers in Each Node - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.ArrayDeque; import java.util.Queue; public class PopulatingNextRightPointersinEachNode { public .. 2020. 11. 29.
[leetcode] Permutations https://leetcode.com/problems/permutations/ Permutations - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.ArrayList; import java.util.List; public class Permutations { public static void main(String[] args) { System.out.println(permute(new int[] {1})); } static Li.. 2020. 11. 29.
[leetcode] PacificAtlanticWaterFlow https://leetcode.com/problems/pacific-atlantic-water-flow/ Pacific Atlantic Water Flow - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.Queue; public class PacificAtlanticWaterFlow { p.. 2020. 11. 29.
[leetcode] NumberofIslands https://leetcode.com/problems/number-of-islands/ Number of Islands - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.ArrayDeque; import java.util.Queue; //Complete public class NumberofIslands { public static void main(String[] args) { char[][] param = new char[][].. 2020. 11. 29.
[leetcode] String to Integer (atoi) leetcode.com/problems/string-to-integer-atoi/ String to Integer (atoi) - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com public class MyAtoi { public static void main(String[] args) { System.out.println(myAtoi("2147483646")); } public static int myAtoi(String s) { // Discard whites.. 2020. 11. 29.
[leetcode] MinStack https://leetcode.com/problems/min-stack/ Min Stack - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Stack; public class MinStack { private Stack stack; private List list; public stati.. 2020. 11. 29.
[leetcode] MinimumPathSum https://leetcode.com/problems/minimum-path-sum/ Minimum Path Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com public class MinimumPathSum { public static void main(String[] args) { System.out.println(minPathSum(new int[][] { {1,3,1}, {1,5,1}, {4,2,1} })); } // DP public static.. 2020. 11. 29.