Skip to content

Commit 4cda310

Browse files
committed
adjust the comment length
1 parent ad62b9d commit 4cda310

File tree

73 files changed

+220
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+220
-120
lines changed

src/3Sum/3Sum.cpp

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

55
/**********************************************************************************
66
*
7-
* Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
7+
* Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?
8+
* Find all unique triplets in the array which gives the sum of zero.
89
*
910
* Note:
1011
*

src/3SumClosest/3SumClosest.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
/**********************************************************************************
66
*
7-
* Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
7+
* Given an array S of n integers, find three integers in S such that the sum is
8+
* closest to a given number, target. Return the sum of the three integers.
9+
* You may assume that each input would have exactly one solution.
810
*
911
* For example, given array S = {-1 2 1 -4}, and target = 1.
1012
*

src/4Sum/4Sum.cpp

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

55
/**********************************************************************************
66
*
7-
* Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
7+
* Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target?
8+
* Find all unique quadruplets in the array which gives the sum of target.
89
*
910
* Note:
1011
*

src/LRUCache/LRUCache.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
/**********************************************************************************
66
*
7-
* Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
8-
*
9-
* get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
10-
* set(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.
7+
* Design and implement a data structure for Least Recently Used (LRU) cache.
8+
* It should support the following operations: get and set.
119
*
10+
* get(key) - Get the value (will always be positive) of the key if the key exists
11+
* in the cache, otherwise return -1.
12+
*
13+
* set(key, value) - Set or insert the value if the key is not already present.
14+
* When the cache reached its capacity, it should invalidate
15+
* the least recently used item before inserting a new item.
1216
*
1317
**********************************************************************************/
1418

src/addTwoNumbers/addTwoNumbers.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
/**********************************************************************************
66
*
7-
* You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
7+
* You are given two linked lists representing two non-negative numbers.
8+
* The digits are stored in reverse order and each of their nodes contain a single digit.
9+
* Add the two numbers and return it as a linked list.
810
*
911
* Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
1012
* Output: 7 -> 0 -> 8

src/balancedBinaryTree/balancedBinaryTree.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* Given a binary tree, determine if it is height-balanced.
88
*
9-
* For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
9+
* For this problem, a height-balanced binary tree is defined as a binary tree in which
10+
* the depth of the two subtrees of every node never differ by more than 1.
1011
*
1112
*
1213
**********************************************************************************/

src/bestTimeToBuyAndSellStock/bestTimeToBuyAndSellStock.II.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
*
77
* Say you have an array for which the ith element is the price of a given stock on day i.
88
*
9-
* Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). However, you may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).
9+
* Design an algorithm to find the maximum profit. You may complete as many transactions
10+
* as you like (ie, buy one and sell one share of the stock multiple times). However,
11+
* you may not engage in multiple transactions at the same time (ie, you must sell the
12+
* stock before you buy again).
1013
*
1114
**********************************************************************************/
1215

src/bestTimeToBuyAndSellStock/bestTimeToBuyAndSellStock.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* Say you have an array for which the ith element is the price of a given stock on day i.
88
*
9-
* If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
9+
* If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
10+
* design an algorithm to find the maximum profit.
1011
*
1112
**********************************************************************************/
1213

src/binaryTreeInorderTraversal/binaryTreeInorderTraversal.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
*
2424
* OJ's Binary Tree Serialization:
2525
*
26-
* The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
26+
* The serialization of a binary tree follows a level order traversal, where '#' signifies
27+
* a path terminator where no node exists below.
2728
*
2829
* Here's an example:
2930
*

src/binaryTreeLevelOrderTraversal/binaryTreeLevelOrderTraversal.II.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**********************************************************************************
66
*
7-
* Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
7+
* Given a binary tree, return the bottom-up level order traversal of its nodes' values.
8+
* (ie, from left to right, level by level from leaf to root).
89
*
910
* For example:
1011
* Given binary tree {3,9,20,#,#,15,7},
@@ -27,7 +28,8 @@
2728
*
2829
* OJ's Binary Tree Serialization:
2930
*
30-
* The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
31+
* The serialization of a binary tree follows a level order traversal, where '#' signifies
32+
* a path terminator where no node exists below.
3133
*
3234
* Here's an example:
3335
*

src/binaryTreeLevelOrderTraversal/binaryTreeLevelOrderTraversal.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**********************************************************************************
66
*
7-
* Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
7+
* Given a binary tree, return the level order traversal of its nodes' values.
8+
* (ie, from left to right, level by level).
89
*
910
* For example:
1011
* Given binary tree {3,9,20,#,#,15,7},
@@ -27,7 +28,8 @@
2728
*
2829
* OJ's Binary Tree Serialization:
2930
*
30-
* The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
31+
* The serialization of a binary tree follows a level order traversal, where '#' signifies
32+
* a path terminator where no node exists below.
3133
*
3234
* Here's an example:
3335
*

src/binaryTreeZigzagLevelOrderTraversal/binaryTreeZigzagLevelOrderTraversal.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**********************************************************************************
66
*
7-
* Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
7+
* Given a binary tree, return the zigzag level order traversal of its nodes' values.
8+
* (ie, from left to right, then right to left for the next level and alternate between).
89
*
910
* For example:
1011
* Given binary tree {3,9,20,#,#,15,7},
@@ -27,7 +28,8 @@
2728
*
2829
* OJ's Binary Tree Serialization:
2930
*
30-
* The serialization of a binary tree follows a level order traversal, where '#' signifies a path terminator where no node exists below.
31+
* The serialization of a binary tree follows a level order traversal,
32+
* where '#' signifies a path terminator where no node exists below.
3133
*
3234
* Here's an example:
3335
*

src/combinationSum/combinationSum.II.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44

55
/**********************************************************************************
66
*
7-
* Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
7+
* Given a collection of candidate numbers (C) and a target number (T), find all
8+
* unique combinations in C where the candidate numbers sums to T.
89
*
910
* Each number in C may only be used once in the combination.
1011
*
1112
* Note:
1213
*
13-
* All numbers (including target) will be positive integers.
14-
* Elements in a combination (a1, a2, … , ak) must be in non-descending order. (ie, a1 ≤ a2 ≤ … ≤ ak).
15-
* The solution set must not contain duplicate combinations.
14+
* > All numbers (including target) will be positive integers.
15+
* > Elements in a combination (a1, a2, … , ak) must be in non-descending order.
16+
* (ie, a1 ≤ a2 ≤ … ≤ ak).
17+
* > The solution set must not contain duplicate combinations.
1618
*
1719
* For example, given candidate set 10,1,2,7,6,1,5 and target 8,
1820
* A solution set is:

src/combinationSum/combinationSum.cpp

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

55
/**********************************************************************************
66
*
7-
* Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
7+
* Given a set of candidate numbers (C) and a target number (T), find all unique combinations
8+
* in C where the candidate numbers sums to T.
89
*
910
* The same repeated number may be chosen from C unlimited number of times.
1011
*

src/containerWithMostWater/containerWithMostWater.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
/**********************************************************************************
66
*
7-
* Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.
7+
* Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai).
8+
* n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0).
9+
*
10+
* Find two lines, which together with x-axis forms a container, such that the container contains the most water.
811
*
912
* Note: You may not slant the container.
1013
*

src/convertSortedListToBinarySearchTree/convertSortedListToBinarySearchTree.cpp

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

55
/**********************************************************************************
66
*
7-
* Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
7+
* Given a singly linked list where elements are sorted in ascending order,
8+
* convert it to a height balanced BST.
89
*
910
**********************************************************************************/
1011

src/copyListWithRandomPointer/copyListWithRandomPointer.cpp

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

55
/**********************************************************************************
66
*
7-
* A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
7+
* A linked list is given such that each node contains an additional random pointer
8+
* which could point to any node in the list or null.
89
*
910
* Return a deep copy of the list.
1011
*

src/distinctSubsequences/distinctSubsequences.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*
77
* Given a string S and a string T, count the number of distinct subsequences of T in S.
88
*
9-
* A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).
9+
* A subsequence of a string is a new string which is formed from the original string
10+
* by deleting some (can be none) of the characters without disturbing the relative positions
11+
* of the remaining characters. (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).
1012
*
1113
* Here is an example:
1214
* S = "rabbbit", T = "rabbit"

src/editDistance/editDistance.cpp

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

55
/**********************************************************************************
66
*
7-
* Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
7+
* Given two words word1 and word2, find the minimum number of steps required to
8+
* convert word1 to word2. (each operation is counted as 1 step.)
89
*
910
* You have the following 3 operations permitted on a word:
1011
*

src/flattenBinaryTreeToLinkedList/flattenBinaryTreeToLinkedList.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
* \
3030
* 6
3131
*
32-
* click to show hints.
3332
*
3433
* Hints:
35-
* If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal.
36-
*
34+
* If you notice carefully in the flattened tree, each node's right child points to
35+
* the next node of a pre-order traversal.
3736
*
3837
**********************************************************************************/
3938

src/gasStation/gasStation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* There are N gas stations along a circular route, where the amount of gas at station i is gas[i].
88
*
9-
* You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its next station (i+1). You begin the journey with an empty tank at one of the gas stations.
9+
* You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
10+
* its next station (i+1). You begin the journey with an empty tank at one of the gas stations.
1011
*
1112
* Return the starting gas station's index if you can travel around the circuit once, otherwise return -1.
1213
*

src/grayCode/grayCode.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* The gray code is a binary numeral system where two successive values differ in only one bit.
88
*
9-
* Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
9+
* Given a non-negative integer n representing the total number of bits in the code,
10+
* print the sequence of gray code. A gray code sequence must begin with 0.
1011
*
1112
* For example, given n = 2, return [0,1,3,2]. Its gray code sequence is:
1213
*

src/jumpGame/jumpGame.II.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* For example:
1414
* Given array A = [2,3,1,1,4]
1515
*
16-
* The minimum number of jumps to reach the last index is 2. (Jump 1 step from index 0 to 1, then 3 steps to the last index.)
16+
* The minimum number of jumps to reach the last index is 2.
17+
* (Jump 1 step from index 0 to 1, then 3 steps to the last index.)
1718
*
1819
*
1920
**********************************************************************************/

src/largestRectangleInHistogram/largestRectangleInHistogram.cpp

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

55
/**********************************************************************************
66
*
7-
* Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
7+
* Given n non-negative integers representing the histogram's bar height where the width of each bar is 1,
8+
* find the area of largest rectangle in the histogram.
89
*
910
* Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].
1011
*

src/lengthOfLastWord/lengthOfLastWord.cpp

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

55
/**********************************************************************************
66
*
7-
* Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
7+
* Given a string s consists of upper/lower-case alphabets and empty space characters ' ',
8+
* return the length of last word in the string.
89
*
910
* If the last word does not exist, return 0.
1011
*

src/longestPalindromicSubstring/longestPalindromicSubstring.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
/**********************************************************************************
66
*
7-
* Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
7+
* Given a string S, find the longest palindromic substring in S.
8+
* You may assume that the maximum length of S is 1000,
9+
* and there exists one unique longest palindromic substring.
810
*
911
**********************************************************************************/
1012

src/longestSubstringWithoutRepeatingCharacters/longestSubstringWithoutRepeatingCharacters.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
/**********************************************************************************
66
*
7-
* Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
7+
* Given a string, find the length of the longest substring without repeating characters.
8+
* For example, the longest substring without repeating letters for "abcabcbb" is "abc",
9+
* which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
810
*
911
**********************************************************************************/
1012

src/longestValidParentheses/longestValidParentheses.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
/**********************************************************************************
66
*
7-
* Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
7+
* Given a string containing just the characters '(' and ')',
8+
* find the length of the longest valid (well-formed) parentheses substring.
89
*
910
* For "(()", the longest valid parentheses substring is "()", which has length = 2.
1011
*
11-
* Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.
12+
* Another example is ")()())", where the longest valid parentheses substring is "()()",
13+
* which has length = 4.
1214
*
1315
*
1416
**********************************************************************************/

src/maximalRectangle/maximalRectangle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
/**********************************************************************************
66
*
7-
* Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
8-
*
7+
* Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle
8+
* containing all ones and return its area.
99
*
1010
**********************************************************************************/
1111

src/maximumDepthOfBinaryTree/maximumDepthOfBinaryTree.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* Given a binary tree, find its maximum depth.
88
*
9-
* The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
9+
* The maximum depth is the number of nodes along the longest path from the root node
10+
* down to the farthest leaf node.
1011
*
1112
**********************************************************************************/
1213

src/maximumProductSubarray/maximumProductSubarray.cpp

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

55
/**********************************************************************************
66
*
7-
* Find the contiguous subarray within an array (containing at least one number) which has the largest product.
7+
* Find the contiguous subarray within an array (containing at least one number)
8+
* which has the largest product.
89
*
910
* For example, given the array [2,3,-2,4],
1011
* the contiguous subarray [2,3] has the largest product = 6.

0 commit comments

Comments
 (0)