Skip to content

Commit ae373af

Browse files
committed
clean up
1 parent 0722a3b commit ae373af

14 files changed

+28
-40
lines changed

Diff for: 238.ProductExceptSelf.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
// 238. Product of Array Except Self
22

3-
// Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
3+
// Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of
4+
// nums except nums[i].
45

56
// The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.
6-
77
// You must write an algorithm that runs in O(n) time and without using the division operation.
88

9-
10-
119
// Example 1:
12-
1310
// Input: nums = [1,2,3,4]
1411
// Output: [24,12,8,6]
1512
// Example 2:
16-
1713
// Input: nums = [-1,1,0,-3,3]
1814
// Output: [0,0,9,0,0]
1915

Diff for: 239.MaxSlidingWindow.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// 239. Sliding Window Maximum
22

3-
// You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
4-
3+
// You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the
4+
// array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one
5+
// position.
56
// Return the max sliding window.
67

78
//Deque implementation via List

Diff for: 242.IsAnagram.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
// Given two strings s and t, return true if t is an anagram of s, and false otherwise.
44

5-
// An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
5+
// An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all
6+
// the original letters exactly once.
67

78
public class Solution {
89
public bool IsAnagram(string s, string t) {

Diff for: 275.HIndex.cs

-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@
88

99
// You must write an algorithm that runs in logarithmic time.
1010

11-
12-
1311
// Example 1:
14-
1512
// Input: citations = [0,1,3,5,6]
1613
// Output: 3
1714
// Explanation: [0,1,3,5,6] means the researcher has 5 papers in total and each of them had received 0, 1, 3, 5, 6 citations respectively.
1815
// Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, their h-index is 3.
1916
// Example 2:
20-
2117
// Input: citations = [1,2,100]
2218
// Output: 2
2319

Diff for: 278.FirstBadVersion.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
//278. First Bad Version
2-
//You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.
3-
//Suppose you have n versions[1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad.
4-
//You are given an API bool isBadVersion(version) which returns whether version is bad.Implement a function to find the first bad version.You should minimize the number of calls to the API.
2+
//You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of
3+
// your product fails the quality check. Since each version is developed based on the previous version, all the versions after
4+
// a bad version are also bad.
5+
//Suppose you have n versions[1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to
6+
// be bad.
7+
//You are given an API bool isBadVersion(version) which returns whether version is bad.Implement a function to find the first
8+
// bad version.You should minimize the number of calls to the API.
59

610
//The isBadVersion API is defined in the parent class VersionControl.
711
//bool IsBadVersion(int version);

Diff for: 286.MissingNumber.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// 268. Missing Number
22

3-
// Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
4-
5-
3+
// Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing
4+
// from the array.
65

76
// Example 1:
8-
97
// Input: nums = [3,0,1]
108
// Output: 2
11-
// Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.
12-
13-
9+
// Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range
10+
// since it does not appear in nums.
1411

1512
public class Solution {
1613
public int MissingNumber(int[] nums) {

Diff for: 287.FindDuplicate.cs

-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
// You must solve the problem without modifying the array nums and uses only constant extra space.
88

9-
10-
119
// Example 1:
12-
1310
// Input: nums = [1,3,4,2,2]
1411
// Output: 2
1512

Diff for: 326.IsPowerOfThree.cs

-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33
// Given an integer n, return true if it is a power of three. Otherwise, return false.
44

55
// An integer n is a power of three, if there exists an integer x such that n == 3x.
6-
7-
8-
96
// Example 1:
107

118
// Input: n = 27
129
// Output: true
1310
// Explanation: 27 = 33
1411
// Example 2:
15-
1612
// Input: n = 0
1713
// Output: false
1814
// Explanation: There is no x where 3x = 0.

Diff for: 328.OddEvenList.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// 328. Odd Even Linked List
2-
// Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
2+
// Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even
3+
// indices, and return the reordered list.
34
// The first node is considered odd, and the second node is even, and so on.
45
// Note that the relative order inside both the even and odd groups should remain as it was in the input.
56
// You must solve the problem in O(1) extra space complexity and O(n) time complexity.

Diff for: 342.IsPowerOfFour.cs

-5
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44

55
// An integer n is a power of four, if there exists an integer x such that n == 4x.
66

7-
8-
97
// Example 1:
10-
118
// Input: n = 16
129
// Output: true
1310
// Example 2:
14-
1511
// Input: n = 5
1612
// Output: false
1713
// Example 3:
18-
1914
// Input: n = 1
2015
// Output: true
2116

Diff for: 349.Intersection.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// 349. Intersection of Two Arrays
2-
// Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order.
2+
// Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique
3+
// and you may return the result in any order.
34

45
// Example 1:
56
// Input: nums1 = [1,2,2,1], nums2 = [2,2]

Diff for: 350.Intersect.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// 350. Intersection of Two Arrays II
2-
// Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order.
2+
// Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear
3+
// as many times as it shows in both arrays and you may return the result in any order.
34

45
// Example 1:
56

Diff for: 374.GuessNumber.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public int GuessNumber(int n) {
4141
}
4242
else if (res == -1 )
4343
{
44-
high = mid -1;
44+
high = mid -1;
4545
}
4646
else if(res == 1)
4747
{

Diff for: 392.IsSubsequence.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// 392. Is Subsequence
22
// Given two strings s and t, return true if s is a subsequence of t, or false otherwise.
3-
// A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).
3+
// A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the
4+
// characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde"
5+
// while "aec" is not).
46

57
public class Solution
68
{

0 commit comments

Comments
 (0)