Skip to content

Commit 0596778

Browse files
author
0x01f7
committed
style: comment
1 parent d38eca0 commit 0596778

File tree

5 files changed

+35
-33
lines changed

5 files changed

+35
-33
lines changed

algorithms/climbing_stairs.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://leetcode.com/problems/climbing-stairs/
22
#
3-
# You are climbing a stair case. It takes n steps to reach to the
4-
# top. Each time you can either climb 1 or 2 steps. In how many
5-
# distinct ways can you climb to the top?
3+
# You are climbing a stair case. It takes n steps to reach to the top. Each
4+
# time you can either climb 1 or 2 steps. In how many distinct ways can you
5+
# climb to the top?
66

77

88
# @param {Integer} n

algorithms/combination_sum.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# https://leetcode.com/problems/combination-sum/
22
#
3-
# Given a set of candidate numbers(C) and a target number(T), find all
4-
# unique combinations in C where the candidate numbers sums to T.
3+
# Given a set of candidate numbers(C) and a target number(T), find all unique
4+
# combinations in C where the candidate numbers sums to T. The same repeated
5+
# number may be chosen from C unlimited number of times.
56
#
6-
# The same repeated number may be chosen from C unlimited number of
7-
# times.
8-
#
9-
# Note:
7+
# Notes:
108
#
119
# + All numbers (including target) will be positive integers.
12-
# + Elements in a combination (a1, a2, ..., ak) must be in
13-
# non-descending order. (ie, a1 <= a2 <= ... <= ak).
10+
# + Elements in a combination (a1, a2, ..., ak) must be in non-descending
11+
# order. (ie, a1 <= a2 <= ... <= ak).
1412
# + The solution set must not contain duplicate combinations.
1513
#
16-
# For example, given candidate set 2,3,6,7 and target 7, A solution set is:
14+
# For example, given candidate set {2, 3, 6, 7} and target 7, A solution set
15+
# is:
1716
#
1817
# [7]
1918
# [2, 2, 3]

algorithms/combination_sum_ii.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# https://leetcode.com/problems/combination-sum-ii/
22
#
3-
# Given a collection of candidate numbers(C) and a target number(T), find
4-
# all unique combinations in C where the candidate numbers sums to T.
3+
# Given a collection of candidate numbers(C) and a target number(T), find all
4+
# unique combinations in C where the candidate numbers sums to T. Each number
5+
# in C may only be used once in the combination.
56
#
6-
# Each number in C may only be used once in the combination.
7-
#
8-
# Note:
7+
# Notes:
98
#
109
# + All numbers (including target) will be positive integers.
11-
# + Elements in a combination (a1, a2, ..., ak) must be in
12-
# non-descending order. (ie, a1 <= a2 <= ... <= ak).
10+
# + Elements in a combination (a1, a2, ..., ak) must be in non-descending
11+
# order. (ie, a1 <= a2 <= ... <= ak).
1312
# + The solution set must not contain duplicate combinations.
1413
#
15-
# For example, given candidate set 10,1,2,7,6,1,5 and target 8, A
14+
# For example, given candidate set {10, 1, 2, 7, 6, 1, 5} and target 8, a
1615
# solution set is:
1716
#
1817
# [1, 7]

algorithms/combination_sum_iii.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# https://leetcode.com/problems/combination-sum-iii/
22
#
3-
# Find all possible combinations of k numbers that add up to a
4-
# number n, given that only numbers from 1 to 9 can be used
5-
# and each combination should be a unique set of numbers.
6-
#
7-
# Ensure that numbers within the set are sorted in ascending order.
3+
# Find all possible combinations of k numbers that add up to a number n, given
4+
# that only numbers from 1 to 9 can be used and each combination should be a
5+
# unique set of numbers. Ensure that numbers within the set are sorted in
6+
# ascending order.
87
#
98
# Example 1:
109
#
1110
# Input: k = 3, n = 7
12-
# Output: [[1,2,4]]
11+
# Output: [[1, 2, 4]]
1312
#
1413
# Example 2:
1514
#
1615
# Input: k = 3, n = 9
17-
# Output: [[1,2,6], [1,3,5], [2,3,4]]
16+
# Output: [[1, 2, 6], [1, 3, 5], [2, 3, 4]]
17+
#
18+
# Credits:
19+
#
20+
# Special thanks to @mithmatt for adding this problem and creating all
21+
# test cases.
1822

1923

2024
# @param {Integer} k

algorithms/combinations.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# For example, If n = 4 and k = 2, a solution is:
77
#
88
# [
9-
# [2,4],
10-
# [3,4],
11-
# [2,3],
12-
# [1,2],
13-
# [1,3],
14-
# [1,4],
9+
# [2, 4],
10+
# [3, 4],
11+
# [2, 3],
12+
# [1, 2],
13+
# [1, 3],
14+
# [1, 4],
1515
# ]
1616

1717

0 commit comments

Comments
 (0)