Skip to content

Commit 260948a

Browse files
aarkalykARKALYK AKASH
authored andcommitted
Comments added
1 parent ffea424 commit 260948a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Egg Drop Problem/EggDrop.playground/Sources/EggDrop.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ public func eggDrop(numberOfEggs: Int, numberOfFloors: Int) -> Int {
22
if numberOfEggs == 0 || numberOfFloors == 0{ //edge case: When either number of eggs or number of floors is 0, answer is 0
33
return 0
44
}
5-
if numberOfEggs == 1 || numberOfFloors == 1{
5+
if numberOfEggs == 1 || numberOfFloors == 1{ //edge case: When either number of eggs or number of floors is 1, answer is 1
66
return 1
77
}
88

@@ -33,6 +33,7 @@ public func eggDrop(numberOfEggs: Int, numberOfFloors: Int) -> Int {
3333
return eggFloor[numberOfEggs][numberOfFloors]
3434
}
3535

36+
//Helper function to find max of two integers
3637
public func max(_ x1: Int, _ x2: Int) -> Int{
3738
return x1 > x2 ? x1 : x2
3839
}

Egg Drop Problem/EggDrop.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ public func eggDrop(numberOfEggs: Int, numberOfFloors: Int) -> Int {
22
if numberOfEggs == 0 || numberOfFloors == 0{ //edge case: When either number of eggs or number of floors is 0, answer is 0
33
return 0
44
}
5-
if numberOfEggs == 1 || numberOfFloors == 1{
5+
if numberOfEggs == 1 || numberOfFloors == 1{ //edge case: When either number of eggs or number of floors is 1, answer is 1
66
return 1
77
}
88

@@ -33,6 +33,7 @@ public func eggDrop(numberOfEggs: Int, numberOfFloors: Int) -> Int {
3333
return eggFloor[numberOfEggs][numberOfFloors]
3434
}
3535

36+
//Helper function to find max of two integers
3637
public func max(_ x1: Int, _ x2: Int) -> Int{
3738
return x1 > x2 ? x1 : x2
3839
}

0 commit comments

Comments
 (0)