Skip to content

Commit 359cb50

Browse files
committed
remove require set
1 parent fd9cdfd commit 359cb50

7 files changed

+0
-14
lines changed

algorithms/intersection.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# node of the first linked list is the exact same node (by reference) as the jth node of the second
55
# linked list, then they are intersecting.
66

7-
require 'Set'
8-
97
class Node
108
attr_accessor :data, :next, :prev
119
def initialize(data)

algorithms/is_unique.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Is Unique: Implement an algorithm to determine if a string has all unique characters. What if you
33
# cannot use additional data structures?
44

5-
require 'Set'
6-
75
# O(n) solution
86
# The string length will be the same as the set length if it is all unique characters
97
def unique_1?(str)

algorithms/loop_detection.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# Input: A -) B -) C -) D -) E -) C
99
# Output: C
1010

11-
require 'Set'
12-
1311
class Node
1412
attr_accessor :data, :next, :prev
1513
def initialize(data)

algorithms/remove_duplicates.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'Set'
2-
31
# @param {String} text
42
# @return {String}
53

algorithms/remove_duplicates_in_linked_list.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Remove Dups: Write code to remove duplicates from an unsorted linked list.
33
# How would you solve this problem if a temporary buffer is not allowed?
44

5-
require 'Set'
6-
75
class Node
86
attr_accessor :data, :next
97
def initialize(data)

algorithms/string_rotation.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# of another. Given two strings, 51 and 52, write code to check if 52 is a rotation of 51 using only one
44
# call to isSubstring (e.g., "waterbottle" is a rotation of"erbottlewat").
55

6-
require 'Set'
7-
86
# Looping is O(n), concatination is O(n), and comparision is also O(n) making this O(n^2)
97
def rotation_1?(str1, str2)
108
return false unless str1.size == str2.size

algorithms/zero_matrix.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# Zero Matrix: Write an algorithm such that if an element in an MxN matrix is 0, its entire row and
33
# column are set to O.
44

5-
require 'Set'
6-
75
# Matrix is NxM
86
class Matrix
97
def initialize(matrix_array)

0 commit comments

Comments
 (0)