Skip to content

Commit 45ac5e1

Browse files
committed
Change File structure
1 parent 2c3676d commit 45ac5e1

File tree

6 files changed

+16
-34
lines changed

6 files changed

+16
-34
lines changed

ScalaSolutions/build.sbt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
val dottyVersion = "0.26.0-RC1"
1+
//val dottyVersion = "0.26.0-RC1"
22

33
lazy val root = project
44
.in(file("."))
55
.settings(
6-
name := "dotty-simple",
6+
name := "LeetCode Scala Solutions",
77
version := "0.1.0",
88

9-
scalaVersion := dottyVersion,
9+
scalaVersion := 3.1,
1010

1111
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
1212
)

ScalaSolutions/src/main/scala/Main.scala

-20
This file was deleted.

ScalaSolutions/src/main/scala/TwoSum_p1/Solution.scala renamed to ScalaSolutions/src/main/scala/p1_TwoSum.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package TwoSum_p1
2-
31
/**
42
* https://leetcode.com/problems/two-sum/
53
* Given an array of integers nums and an integer target,
@@ -9,7 +7,7 @@ package TwoSum_p1
97
* You can return the answer in any order.
108
* @tags: easy
119
*/
12-
object Solution {
10+
object p1_TwoSum {
1311

1412
def twoSum(nums: Array[Int], target: Int): Array[Int] = {
1513
def twoSum(index: Int, previous: Map[Int, Int]): Array[Int] = {

ScalaSolutions/src/main/scala/ValidParentheses_p20/Solution.scala renamed to ScalaSolutions/src/main/scala/p20_ValidParentheses.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package ValidParentheses_p20
2-
31
import scala.collection.mutable.Stack
42

53
/**
@@ -12,7 +10,7 @@ import scala.collection.mutable.Stack
1210
*
1311
* @tags: easy
1412
*/
15-
object Solution {
13+
object p20_ValidParentheses {
1614

1715
import scala.collection.mutable.Stack
1816
val stack = new Stack[Char]()

ScalaSolutions/src/main/scala/Sqrt_p69/Solution.scala renamed to ScalaSolutions/src/main/scala/p69_SqrtX.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
package Sqrt_p69
2-
31
/**
42
* https://leetcode.com/problems/sqrtx/
53
* Given a non-negative integer x, compute and return the square root of x.
64
* Since the return type is an integer, the decimal digits are truncated,
75
* and only the integer part of the result is returned.
86
*/
9-
object Solution {
7+
object p69_SqrtX {
108
/**
119
* I am gonna Use Newton's method to calculate it as it is fun
1210
* and used in many functional programing courses as a reference

ScalaSolutions/src/main/scala/worksheet.sc

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
* For tests and checks
33
*/
44

5-
object Solution {
65

7-
}
6+
// Creating a map
7+
val OpenToClose: Map[Char, Char] = Map('{' -> '}', '[' -> ']', '(' -> ')')
8+
9+
// Applying contains method
10+
val result = OpenToClose.contains(2)
11+
val result2 = OpenToClose.contains(3)
12+
13+
// Displays output
14+
println(result)
15+
println(result2)

0 commit comments

Comments
 (0)