Skip to content

Commit 47128f5

Browse files
author
0x01f7
committed
style: comment
1 parent 65bb25a commit 47128f5

9 files changed

+45
-46
lines changed

algorithms/implement_queue_using_stacks.rb

+8-10
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
#
1010
# Notes:
1111
#
12-
# + You must use only standard operations of a stack --
13-
# which means only push to top, peek/pop from top, size,
14-
# and is empty operations are valid.
15-
# + Depending on your language, stack may not be supported
16-
# natively. You may simulate a stack by using a list or
17-
# deque (double-ended queue), as long as you use only
18-
# standard operations of a stack.
19-
# + You may assume that all operations are valid (for
20-
# example,no pop or peek operations will be called on
21-
# an empty queue).
12+
# + You must use only standard operations of a stack -- which means only
13+
# push to top, peek/pop from top, size, and is empty operations are
14+
# valid.
15+
# + Depending on your language, stack may not be supported natively. You
16+
# may simulate a stack by using a list or deque (double-ended queue), as
17+
# long as you use only standard operations of a stack.
18+
# + You may assume that all operations are valid (for example,no pop or
19+
# peek operations will be called on an empty queue).
2220

2321

2422
class Queue

algorithms/implement_stack_using_queues.rb

+13-10
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99
#
1010
# Notes:
1111
#
12-
# + You must use only standard operations of a queue --
13-
# which means only push to back, peek/pop from front, size,
14-
# and is empty operations are valid.
15-
# + Depending on your language, queue may not be supported
16-
# natively. You may simulate a queue by using a list or
17-
# deque (double-ended queue), as long as you use only
18-
# standard operations of a queue.
19-
# + You may assume that all operations are valid (for
20-
# example, no pop or top operations will be called on
21-
# an empty stack).
12+
# + You must use only standard operations of a queue -- which means only
13+
# push to back, peek/pop from front, size, and is empty operations are
14+
# valid.
15+
# + Depending on your language, queue may not be supported natively. You
16+
# may simulate a queue by using a list or deque (double-ended queue), as
17+
# long as you use only standard operations of a queue.
18+
# + You may assume that all operations are valid (for example, no pop or
19+
# top operations will be called on an empty stack).
20+
#
21+
# Credits:
22+
#
23+
# Special thanks to @jianchao.li.fighter for adding this problem and all
24+
# test cases.
2225

2326

2427
class Stack

algorithms/implement_strstr.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://leetcode.com/problems/implement-strstr/
22
#
3-
# Implement strStr(). Returns the index of the first occurrence of
4-
# needle in haystack, or -1 if needle is not part of haystack.
3+
# Implement strStr(). Returns the index of the first occurrence of needle in
4+
# haystack, or -1 if needle is not part of haystack.
55

66

77
# @param {String} haystack

algorithms/implement_trie_prefix_tree.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#
33
# Implement a trie with insert, search, and startsWith methods.
44
#
5-
# Note: You may assume that all inputs are consist of lowercase
6-
# letters a-z.
5+
# Note: You may assume that all inputs are consist of lowercase letters a-z.
76

87

98
class TrieNode

algorithms/insert_interval.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# https://leetcode.com/problems/insert-interval/
22
#
3-
# Given a set of non-overlapping intervals, insert a new interval into
4-
# the intervals (merge if necessary).
3+
# Given a set of non-overlapping intervals, insert a new interval into the
4+
# intervals (merge if necessary).
55
#
6-
# You may assume that the intervals were initially sorted according
7-
# to their start times.
6+
# You may assume that the intervals were initially sorted according to their
7+
# start times.
88
#
99
# Example 1:
1010
#
11-
# Given intervals [1,3],[6,9], insert and merge [2,5] in as
12-
# [1,5],[6,9].
11+
# Given intervals [1, 3], [6, 9], insert and merge [2, 5] in as [1, 5],
12+
# [6, 9].
1313
#
1414
# Example 2:
1515
#
16-
# Given [1,2],[3,5],[6,7],[8,10],[12,16], insert and merge [4,9]
17-
# in as [1,2],[3,10],[12,16]. This is because the new interval
18-
# [4,9] overlaps with [3,5],[6,7],[8,10].
16+
# Given [1, 2], [3, 5], [6, 7], [8, 10], [12, 16], insert and merge [4, 9]
17+
# in as [1, 2], [3, 10], [12, 16]. This is because the new interval [4, 9]
18+
# overlaps with [3, 5], [6, 7], [8, 10].
1919

2020

2121
# Definition for an interval.

algorithms/integer_to_english_words.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://leetcode.com/problems/integer-to-english-words/
22
#
3-
# Convert a non-negative integer to its english words representation.
4-
# Given input is guaranteed to be less than 2 ** 31 - 1.
3+
# Convert a non-negative integer to its english words representation. Given
4+
# input is guaranteed to be less than 2 ** 31 - 1.
55
#
66
# For example,
77
#
@@ -10,8 +10,8 @@
1010
# 12345 ->
1111
# Twelve Thousand Three Hundred Forty Five
1212
# 1234567 ->
13-
# One Million Two Hundred Thirty Four Thousand
14-
# Five Hundred Sixty Seven
13+
# One Million Two Hundred Thirty Four Thousand Five Hundred Sixty
14+
# Seven
1515

1616

1717
# @param {Integer} num

algorithms/integer_to_roman.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://leetcode.com/problems/integer-to-roman/
22
#
3-
# Given an integer, convert it to a roman numeral. Input is
4-
# guaranteed to be within the range from 1 to 3999.
3+
# Given an integer, convert it to a roman numeral. Input is guaranteed to be
4+
# within the range from 1 to 3999.
55

66

77
# @param {Integer} num

algorithms/interleaving_string.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# https://leetcode.com/problems/interleaving-string/
22
#
3-
# Given s1, s2, s3, find whether s3 is formed by the interleaving
4-
# of s1 and s2.
3+
# Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
54
#
65
# For example,
76
#

algorithms/isomorphic_strings.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# https://leetcode.com/problems/isomorphic-strings/
22
#
3-
# Given two strings s and t, determine if they are isomorphic. Two
4-
# strings are isomorphic if the characters in s can be replaced to
5-
# get t. All occurrences of a character must be replaced with another
6-
# character while preserving the order of characters. No two characters
7-
# may map to the same character but a character may map to itself.
3+
# Given two strings s and t, determine if they are isomorphic. Two strings are
4+
# isomorphic if the characters in s can be replaced to get t. All occurrences
5+
# of a character must be replaced with another character while preserving the
6+
# order of characters. No two characters may map to the same character but a
7+
# character may map to itself.
88
#
99
# For example,
1010
#

0 commit comments

Comments
 (0)