LeetCode_Study_Plan/LeetCode 75
-
876. Middle of the Linked List javaLeetCode_Study_Plan/LeetCode 75 2022. 10. 5. 23:29
https://leetcode.com/problems/middle-of-the-linked-list/?envType=study-plan&id=level-1 class Solution { public ListNode middleNode(ListNode head) { Map map = new HashMap(); int i = 0; for (; head != null; i++) { map.put(i, head); head = head.next; } int middle = Math.round(i/2); return map.get(middle); } }
-
21. Merge Two Sorted Lists javaLeetCode_Study_Plan/LeetCode 75 2022. 10. 5. 23:12
https://leetcode.com/problems/merge-two-sorted-lists/?envType=study-plan&id=level-1 Merge Two Sorted Lists - 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 class Solution { public ListNode mergeTwoLists(ListNode list1, ListNode list2) { ListNode sortedNode = new ListNode(); ListNo..
-
206. Reverse Linked List javaLeetCode_Study_Plan/LeetCode 75 2022. 10. 5. 22:08
https://leetcode.com/problems/reverse-linked-list/?envType=study-plan&id=level-1 Reverse Linked 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 class Solution { public ListNode reverseList(ListNode head) { ListNode reversedNode = null; while(head != null){ ListNode tmp = hea..
-
392. Is Subsequence javaLeetCode_Study_Plan/LeetCode 75 2022. 10. 4. 23:16
https://leetcode.com/problems/is-subsequence/ class Solution { public boolean isSubsequence(String s, String t) { String[] s_lt = s.split(""); String[] t_lt = t.split(""); if (s.length() == 0) return true; int index = 0; for(String each_t: t_lt){ if (index == s_lt.length) return true; if(s_lt[index].equals(each_t)){ index++; } } if (index == s_lt.length) return true; return false; } }
-
205. Isomorphic Strings javaLeetCode_Study_Plan/LeetCode 75 2022. 9. 26. 22:54
https://leetcode.com/problems/isomorphic-strings/?envType=study-plan&id=level-1 Isomorphic Strings - 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 class Solution { public boolean isIsomorphic(String s, String t) { HashMap map = new HashMap(); int i = 0; while (i < s.length()){ if..
-
724. Find Pivot Index javaLeetCode_Study_Plan/LeetCode 75 2022. 9. 25. 17:13
https://leetcode.com/problems/find-pivot-index/?envType=study-plan&id=level-1 Find Pivot Index - 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 class Solution { public int pivotIndex(int[] nums) { int pivot = 0; int total_sum = Arrays.stream(nums).sum(); for(int i = 0; i < nums.le..
-
1480. Running Sum of 1d Array javaLeetCode_Study_Plan/LeetCode 75 2022. 9. 25. 17:01
https://leetcode.com/problems/running-sum-of-1d-array/?envType=study-plan&id=level-1 Running Sum of 1d Array - 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 class Solution { public int[] runningSum(int[] nums) { Integer[] ans = new Integer[nums.length]; ans[0] = nums[0]; for (int..