Leetcode Diary

Leetcode diary Lc29

Leetcode Diary

Example: Thoughts Code(JAVA)

26. Remove Duplicates from Sorted Array

Leetcode Diary

Problem Description Thoughts classic two pointers iterate array from left to right one pointer for all unique values, one pointer for all values in array Code(JAVA) public int removeDup...

Leetcode diary Lc28

Leetcode Diary

Example: Thoughts Code(JAVA)

Leetcode diary Lc27

Leetcode Diary

Example: Thoughts Code(JAVA)

25. Reverse Nodes in k-Group

Leetcode Diary

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the nu...

24. Swap Nodes in Pairs

Leetcode Diary

Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list’s nodes, only nodes itself may be changed. Example: Given 1->2->3-&g...

23. Merge k Sorted Listss

Leetcode Diary

You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it.s Example: Input: lists ...

22. Generate Parentheses

Leetcode Diary

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example: n = 3 [ "((()))", "(()())", "(())()", "()(())", "()()()" ] Thought...

21. Merge Two Sorted Lists

Leetcode Diary

Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->...

20. Valid Parentheses

Leetcode Diary

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the...