본문 바로가기

Programming/Algorithm29

[leetcode] WordSearch https://leetcode.com/problems/word-search/ Word Search - 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.Stack; public class WordSearch { public static void main(String[] args) { char[][] chars = {{'A', 'B', 'C', 'E'}, {'S', 'F', 'C', 'S'}, {'A', 'D', 'E', 'E'}}; S.. 2020. 11. 29.
[leetcode] WordLadder https://leetcode.com/problems/word-ladder/ Word Ladder - 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 WordLadder { public static void main(String[] args) { // System.out.println(ladderLength("hit", "cog", Arrays.asList("hot", "dot", "dog", "lot", "log", "cog"))); Sy.. 2020. 11. 29.
[leetcode] WordDictionary https://leetcode.com/problems/design-add-and-search-words-data-structure/ Design Add and Search Words Data Structure - 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.HashMap; import java.util.List; import java.util.Map; public class Wor.. 2020. 11. 29.
[leetcode] ValidParentheses https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - 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.Stack; public class ValidParentheses { public static void main(String[] args) { System.out.println(isValid("{}[][](()){[[]]}")); } // stack public s.. 2020. 11. 29.
[leetcode] ValidateBinarySearchTree https://leetcode.com/problems/validate-binary-search-tree/ Validate Binary Search Tree - 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.TreeNode; public class ValidateBinarySearchTree { public static void main(String[] args) { TreeNode node6 = new TreeNode(1); TreeNode.. 2020. 11. 29.
[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.