Skip to content

Commit a3f638a

Browse files
add problem descriptions
1 parent 388ff27 commit a3f638a

8 files changed

+31
-14
lines changed
File renamed without changes.

EASY/src/easy/ClosestBinarySearchTreeValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package easy;
22

33
import classes.TreeNode;
4+
/**Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target.
45
6+
Note:
7+
Given target value is a floating point.
8+
You are guaranteed to have only one unique value in the BST that is closest to the target.*/
59
public class ClosestBinarySearchTreeValue {
610

711
class General_tree_solution {

EASY/src/easy/CompareVersionNumbers.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
package easy;
2+
/**Compare two version numbers version1 and version2.
3+
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
4+
5+
You may assume that the version strings are non-empty and contain only digits and the . character.
6+
The . character does not represent a decimal point and is used to separate number sequences.
7+
For instance, 2.5 is not "two and a half" or "half way to version three", it is the fifth second-level revision of the second first-level revision.
8+
9+
Here is an example of version numbers ordering:
10+
11+
0.1 < 1.1 < 1.2 < 13.37*/
212

313
public class CompareVersionNumbers {
414

EASY/src/easy/ContainsDuplicate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.Set;
55

66
/**
7-
* 217. Contains Duplicate QuestionEditorial Solution My Submissions Total Accepted: 106831 Total
8-
* Submissions: 252115 Difficulty: Easy Given an array of integers, find if the array contains any
7+
* 217. Contains Duplicate
8+
* Given an array of integers, find if the array contains any
99
* duplicates. Your function should return true if any value appears at least twice in the array,
1010
* and it should return false if every element is distinct.
1111
*/

EASY/src/easy/ContainsDuplicateII.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import java.util.HashMap;
44
import java.util.Map;
55

6-
/**219. Contains Duplicate II QuestionEditorial Solution My Submissions
7-
Total Accepted: 69920
8-
Total Submissions: 228733
9-
Difficulty: Easy
6+
/**219. Contains Duplicate II
7+
*
108
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.*/
119
public class ContainsDuplicateII {
1210
//pretty straightforward, use a hashmap, key is the number itself, value is the last index that this value appeared in the array

EASY/src/easy/CountandSay.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
package easy;
22

33
public class CountandSay {
4+
/**The count-and-say sequence is the sequence of integers beginning as follows:
5+
1, 11, 21, 1211, 111221, ...
46
7+
1 is read off as "one 1" or 11.
8+
11 is read off as "two 1s" or 21.
9+
21 is read off as "one 2, then one 1" or 1211.
10+
Given an integer n, generate the nth sequence.
11+
12+
Note: The sequence of integers will be represented as a string.*/
513
public String countAndSay(int n) {
614
StringBuilder curr = new StringBuilder("1");
715
StringBuilder prev;

EASY/src/easy/DeleteNodeInALinkedList.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22

33
import classes.ListNode;
44

5-
/**237. Delete Node in a Linked List QuestionEditorial Solution My Submissions
6-
Total Accepted: 96741
7-
Total Submissions: 218247
8-
Difficulty: Easy
5+
/**237. Delete Node in a Linked List
6+
*
97
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
108
119
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
12-
13-
Hide Company Tags Adobe Apple Microsoft
14-
Hide Tags Linked List
15-
Hide Similar Problems (E) Remove Linked List Elements
1610
*/
1711
public class DeleteNodeInALinkedList {
1812

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@
7373
|249|[Group Shifted Strings](https://leetcode.com/problems/group-shifted-strings/)|[Solution](../../blob/master/EASY/src/easy/GroupShiftedStrings.java) | O(nlogn) | O(n) |
7474
|246|[Strobogrammatic Number](https://leetcode.com/problems/strobogrammatic-number/)|[Solution](../../blob/master/EASY/src/easy/StrobogrammaticNumber.java) | O(n) | O(1) |
7575
|243|[Shortest Word Distance](https://leetcode.com/problems/shortest-word-distance/)|[Solution](../../blob/master/EASY/src/easy/ShortestWordDistance.java) | O(n) | O(1) |
76+
|237|[Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/)|[Solution](../../blob/master/EASY/src/easy/DeleteNodeInALinkedList.java)| O(1)|O(1) | Easy| LinkedList
7677
|226|[Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/)|[Solution](../../blob/master/EASY/src/easy/InvertBinaryTree.java)| O(n)|O(h) | Easy| DFS, recursion
7778
|223|[Rectangle Area](https://leetcode.com/problems/rectangle-area/)|[Solution](../../blob/master/EASY/src/easy/RectangleArea.java)| O(1)|O(1) | Easy|
7879
|219|[Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii/)|[Solution](../../blob/master/EASY/src/easy/ContainsDuplicateII.java)| O(n)|O(n) | Easy| HashMap
80+
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/)|[Solution](../../blob/master/EASY/src/easy/ContainsDuplicate.java)| O(n)|O(n) | Easy| HashSet
7981
|209|[Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/)|[Solution](../../blob/master/MEDIUM/src/medium/MinimumSizeSubarraySum.java)| O(n)|O(1) | Medium|
8082
|208|[Implement Trie](https://leetcode.com/problems/implement-trie-prefix-tree/)|[Solution](../../blob/master/MEDIUM/src/medium/ImplementTrie.java)| O(n)|O(1) | Medium|
8183
|206|[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/)|[Solution](../../blob/master/EASY/src/easy/ReverseLinkedList.java)| O(n)|O(1) | Easy
@@ -128,6 +130,7 @@
128130
|47|[Permutations II](https://leetcode.com/problems/permutations-ii/)|[Solution](../../blob/master/MEDIUM/src/medium/PermutationsII.java)|O(n*n!)|O(n)|Medium|Backtracking
129131
|43|[Multiply Strings](https://leetcode.com/problems/multiply-strings/)|[Solution]|||Medium
130132
|39|[Combination Sum](https://leetcode.com/problems/combination-sum/)|[Solution](../../blob/master/MEDIUM/src/medium/CombinationSum.java)|O(k*n^k)|O(k)|Medium|Backtracking
133+
|38|[Count and Say](https://leetcode.com/problems/count-and-say/)|[Solution](../../blob/master/EASY/src/easy/CountandSay.java)|O(n*2^n)|O(2^n)|Easy| Recursion, LinkedList
131134
|34|[Search for a Range](https://leetcode.com/problems/search-for-a-range/)|[Solution](../../blob/master/MEDIUM/src/medium/SearchForARange.java)|O(logn)|O(1)|Medium|Array, Binary Search
132135
|31|[Next Permutation](https://leetcode.com/problems/next-permutation)|[Solution](../../blob/master/MEDIUM/src/medium/NextPermutation.java)|O(n)|O(1)|Medium|Array
133136
|24|[Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/)|[Solution](../../blob/master/EASY/src/easy/SwapNodesinPairs.java)|O(n)|O(1)|Easy| Recursion, LinkedList

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy