Skip to content

Commit 147040f

Browse files
committed
Fix compiling errors
1 parent 3fff6ab commit 147040f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+232
-245
lines changed

src/main/scala/DynamicProgramming/CoinChange.scala

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
package DynamicProgramming
22

3-
/**
4-
* An implementation of famous dynamic programming Coin Change Problem
5-
* Problem Statement: Given an amount and a list of coin change, find number of possible
6-
* combinations to get the amount
3+
/** An implementation of famous dynamic programming Coin Change Problem Problem Statement: Given an amount and a
4+
* list of coin change, find number of possible combinations to get the amount
75
*/
86

9-
107
object CoinChange {
118

12-
/**
13-
*
14-
* @param coins - a list of integers i.e. change coins
15-
* @param money - the target amount
16-
* @return - number of combinations possible to get the amount
9+
/** @param coins
10+
* - a list of integers i.e. change coins
11+
* @param money
12+
* - the target amount
13+
* @return
14+
* - number of combinations possible to get the amount
1715
*/
1816

1917
def coinChange(coins: List[Int], money: Int): Int = {
20-
val combinations :Array[Int] = new Array[Int](money+1)
18+
val combinations: Array[Int] = new Array[Int](money + 1)
2119

2220
combinations(0) = 1
2321

2422
for (coin <- coins) {
2523
for (i <- coin to money) {
2624
if (i >= coin) {
27-
combinations(i) += combinations(i-coin)
25+
combinations(i) += combinations(i - coin)
2826
}
2927
}
3028
}

src/main/scala/Mathematics/Abs.scala

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ package Mathematics
22

33
object Abs {
44

5-
/**
6-
* Method returns absolute value of the number
7-
*
8-
* @param Int
9-
* @return
10-
*/
5+
/** Method returns absolute value of the number
6+
*
7+
* @param Int
8+
* @return
9+
*/
1110

12-
def abs(number : Int): Int = {
13-
if (number < 0)
14-
return number * -1
15-
return number;
16-
}
11+
def abs(number: Int): Int = {
12+
if (number < 0)
13+
return number * -1
14+
return number;
15+
}
1716
}

src/main/scala/Mathematics/AbsMax.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package Mathematics
22

33
object AbsMax {
44

5-
/**
6-
* Method returns absolute Maximum Element from the list
5+
/** Method returns absolute Maximum Element from the list
76
*
87
* @param listOfElements
98
* @return

src/main/scala/Mathematics/AbsMin.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package Mathematics
22

33
object AbsMin {
44

5-
/**
6-
* Method returns Absolute minimum Element from the list
5+
/** Method returns Absolute minimum Element from the list
76
*
87
* @param listOfElements
98
* @return

src/main/scala/Mathematics/BinaryExponentiation.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package Mathematics
22

33
object BinaryExponentiation {
4-
/**
5-
* Method returns the binary exponentiation of a given number
6-
* when base and power are passed the parameters
4+
5+
/** Method returns the binary exponentiation of a given number when base and power are passed the parameters
76
*
8-
* @param Int , Int
7+
* @param Int
8+
* , Int
99
* @return
1010
*/
1111

@@ -19,4 +19,4 @@ object BinaryExponentiation {
1919
return answer * answer
2020
}
2121
}
22-
}
22+
}

src/main/scala/Mathematics/Fibonacci.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package Mathematics
22

33
object Fibonacci {
4-
private val allFibonacci: Stream[Int] = 1 #:: 1 #:: allFibonacci.zip(allFibonacci.tail).map(t => t._1 + t._2)
4+
private val allFibonacci: LazyList[Int] = 1 #:: 1 #:: allFibonacci.zip(allFibonacci.tail).map(t => t._1 + t._2)
55

6-
/**
7-
* Method to use the allFibonacci stream to take the first total numbers
8-
* Using streams is both an easy and efficient way to generate fibonacci numbers (streams are memoized)
6+
/** Method to use the allFibonacci stream to take the first total numbers Using streams is both an easy and
7+
* efficient way to generate fibonacci numbers (streams are memoized)
98
*
109
* @param total
10+
* Maximum number of elements of the sequence
1111
* @return
1212
*/
1313
def fibGenerate(total: Int): Seq[Int] = allFibonacci.take(total)

src/main/scala/Mathematics/FindMax.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package Mathematics
22

33
object FindMax {
44

5-
/**
6-
* Method returns Max Element from the list
5+
/** Method returns Max Element from the list
76
*
87
* @param listOfElements
98
* @return

src/main/scala/Mathematics/FindMin.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package Mathematics
22

33
object FindMin {
44

5-
/**
6-
* Method returns Minimum Element from the list
5+
/** Method returns Minimum Element from the list
76
*
87
* @param listOfElements
98
* @return

src/main/scala/Mathematics/GreaterCommonDivisor.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package Mathematics
22

33
object GreaterCommonDivisor {
44

5-
/**
6-
* Method returns the Greatest Common Divisor of two numbers n, m
5+
/** Method returns the Greatest Common Divisor of two numbers n, m
76
*
8-
* @param num1 , num2
7+
* @param num1
8+
* , num2
99
* @return
1010
*/
1111

src/main/scala/Mathematics/LinearSieve.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package Mathematics
22

33
object LinearSieve {
4-
/**
5-
* Method returns sequence of prime numbers which all are not greater than n
4+
5+
/** Method returns sequence of prime numbers which all are not greater than n
66
*
77
* @param n
88
* @return
99
*/
1010
def getPrimeNumbers(n: Int): Seq[Int] = {
11-
var primeNumbers = Seq.empty[Int]
11+
var primeNumbers = Seq.empty[Int]
1212
val lowestPrimeDivisor: Array[Int] = Array.fill(n + 1)(0)
1313
for (i <- 2 to n) {
1414
if (lowestPrimeDivisor(i) == 0) {

0 commit comments

Comments
 (0)