Skip to content

Commit eaf792a

Browse files
author
0x01f7
committed
style: comment
1 parent 061ae03 commit eaf792a

21 files changed

+101
-70
lines changed

algorithms/majority_element.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# https://leetcode.com/problems/majority-element/
22
#
3-
# Given an array of size n, find the majority element. The majority
4-
# element is the element that appears more than n/2 times. You may
5-
# assume that the array is non-empty and the majority element
6-
# always exist in the array.
3+
# Given an array of size n, find the majority element. The majority element is
4+
# the element that appears more than n/2 times. You may assume that the array
5+
# is non-empty and the majority element always exist in the array.
6+
#
7+
# Credits:
8+
#
9+
# Special thanks to @ts for adding this problem and creating all test
10+
# cases.
711

812

913
# @param {Integer[]} nums

algorithms/max_points_on_a_line.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://leetcode.com/problems/max-points-on-a-line/
22
#
3-
# Given n points on a 2D plane, find the maximum number of points that lie
4-
# on the same straight line.
3+
# Given n points on a 2D plane, find the maximum number of points that lie on
4+
# the same straight line.
55

66

77
# Definition for a point.

algorithms/maximal_rectangle.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://leetcode.com/problems/maximal-rectangle/
22
#
3-
# Given a 2D binary matrix filled with 0's and 1's, find the largest
4-
# rectangle containing all ones and return its area.
3+
# Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle
4+
# containing all ones and return its area.
55

66

77
# @param {Character[][]} matrix

algorithms/maximal_square.rb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
# https://leetcode.com/problems/maximal-square/
22
#
3-
# Given a 2D binary matrix filled with 0's and 1's, find the largest
4-
# square containing all 1's and return its area.
3+
# Given a 2D binary matrix filled with 0's and 1's, find the largest square
4+
# containing all 1's and return its area.
55
#
6-
# For example, given the following matrix:
6+
# For example:
77
#
8-
# 1 0 1 0 0
9-
# 1 0 1 1 1
10-
# 1 1 1 1 1
11-
# 1 0 0 1 0
8+
# Given the following matrix:
129
#
13-
# Return 4.
10+
# 1 0 1 0 0
11+
# 1 0 1 1 1
12+
# 1 1 1 1 1
13+
# 1 0 0 1 0
14+
#
15+
# Return 4.
16+
#
17+
# Credits:
18+
#
19+
# Special thanks to @Freezen for adding this problem and creating all
20+
# test cases.
1421

1522

1623
# @param {Character[][]} matrix

algorithms/maximum_depth_of_binary_tree.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://leetcode.com/problems/maximum-depth-of-binary-tree/
22
#
3-
# Given a binary tree, find its maximum depth. The maximum depth is
4-
# the number of nodes along the longest path from the root node down
5-
# to the farthest leaf node.
3+
# Given a binary tree, find its maximum depth. The maximum depth is the number
4+
# of nodes along the longest path from the root node down to the farthest leaf
5+
# node.
66

77

88
# Definition for a binary tree node.

algorithms/maximum_gap.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# https://leetcode.com/problems/maximum-gap/
22
#
3-
# Given an unsorted array, find the maximum difference between the
4-
# successive elements in its sorted form. Try to solve it in linear
5-
# time/space. Return 0 if the array contains less than 2 elements.
3+
# Given an unsorted array, find the maximum difference between the successive
4+
# elements in its sorted form. Try to solve it in linear time/space. Return 0
5+
# if the array contains less than 2 elements.
66
#
7-
# You may assume all elements in the array are non-negative integers
8-
# and fit in the 32-bit signed integer range.
7+
# You may assume all elements in the array are non-negative integers and fit
8+
# in the 32-bit signed integer range.
9+
#
10+
# Credits:
11+
#
12+
# Special thanks to @porker2008 for adding this problem and creating all
13+
# test cases.
914

1015

1116
# Limits on Integer Constants

algorithms/maximum_product_subarray.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# https://leetcode.com/problems/maximum-product-subarray/
22
#
3-
# Find the contiguous subarray within an array (containing at least one
4-
# number) which has the largest product.
3+
# Find the contiguous subarray within an array (containing at least one number)
4+
# which has the largest product.
55
#
6-
# For example, given the array [2,3,-2,4], the contiguous subarray [2,3]
7-
# has the largest product = 6.
6+
# For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has
7+
# the largest product = 6.
88

99

1010
# @param {Integer[]} nums

algorithms/maximum_subarray.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# https://leetcode.com/problems/maximum-subarray/
22
#
3-
# Find the contiguous subarray within an array (containing at least
4-
# one number) which has the largest sum. For example, given the
5-
# array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1]
6-
# has the largest sum = 6.
3+
# Find the contiguous subarray within an array (containing at least one number)
4+
# which has the largest sum. For example, given the array
5+
# [−2, 1, −3, 4, −1, 2, 1, −5, 4], the contiguous subarray [4, −1, 2, 1] has
6+
# the largest sum = 6.
77

88

99
# @param {Integer[]} nums

algorithms/median_of_two_sorted_arrays.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# https://leetcode.com/problems/median-of-two-sorted-arrays/
22
#
3-
# There are two sorted arrays nums1 and nums2 of size m and n
4-
# respectively. Find the median of the two sorted arrays. The
5-
# overall run time complexity should be O(log(m+n)).
3+
# There are two sorted arrays nums1 and nums2 of size m and n respectively.
4+
# Find the median of the two sorted arrays. The overall run time complexity
5+
# should be O(log(m+n)).
66

77

88
# @param {Integer[]} nums1

algorithms/merge_intervals.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#
55
# For example,
66
#
7-
# Given [1,3],[2,6],[8,10],[15,18],
8-
# return [1,6],[8,10],[15,18].
7+
# Given [1, 3], [2, 6], [8, 10], [15, 18],
8+
# Return [1, 6], [8, 10], [15, 18].
99

1010

1111
# Definition for an interval.

0 commit comments

Comments
 (0)