From 91def6dbbf6a25e0faee948b20bb0f7d121d4aab Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 8 May 2017 15:57:17 +0900 Subject: [PATCH 1/8] Add PlusOne --- src/main/scala/algorithms/array/PlusOne.scala | 10 ++++++++++ src/test/scala/algorithms/array/PlusOneTest.scala | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/main/scala/algorithms/array/PlusOne.scala create mode 100644 src/test/scala/algorithms/array/PlusOneTest.scala diff --git a/src/main/scala/algorithms/array/PlusOne.scala b/src/main/scala/algorithms/array/PlusOne.scala new file mode 100644 index 000000000..06a9e800c --- /dev/null +++ b/src/main/scala/algorithms/array/PlusOne.scala @@ -0,0 +1,10 @@ +package algorithms.array + +/** + * User: before30 + * Date: 2017. 5. 8. + * Time: AM 8:59 + */ +object PlusOne { + +} diff --git a/src/test/scala/algorithms/array/PlusOneTest.scala b/src/test/scala/algorithms/array/PlusOneTest.scala new file mode 100644 index 000000000..0b980dabc --- /dev/null +++ b/src/test/scala/algorithms/array/PlusOneTest.scala @@ -0,0 +1,10 @@ +package algorithms.array + +/** + * User: before30 + * Date: 2017. 5. 8. + * Time: AM 9:16 + */ +class PlusOneTest { + +} From 5c4a6f5528c46ef4dfd79bd2d7f524af9cf8cea2 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 9 May 2017 20:43:05 +0900 Subject: [PATCH 2/8] Change README.md --- src/main/scala/algorithms/array/PlusOne.scala | 42 +++++++++++++++++++ .../scala/algorithms/array/PlusOneTest.scala | 27 +++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/main/scala/algorithms/array/PlusOne.scala b/src/main/scala/algorithms/array/PlusOne.scala index 06a9e800c..d60d92027 100644 --- a/src/main/scala/algorithms/array/PlusOne.scala +++ b/src/main/scala/algorithms/array/PlusOne.scala @@ -1,10 +1,52 @@ package algorithms.array +import scala.collection.immutable.Stream.Empty + /** * User: before30 * Date: 2017. 5. 8. * Time: AM 8:59 + * + * Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. + * You may assume the integer do not contain any leading zero, except the number 0 itself. + * The digits are stored such that the most significant digit is at the head of the list. + * + * Example + * f([1, 2, 3] : 123) = [1, 2, 4]: 124 + * f([9, 9, 9] : 999) = [1, 0, 0, 0]: 1000 */ object PlusOne { + def apply(digits: List[Int], digit: Int): List[Int] = { + plusDigit(digits, digit) + } + + def apply(digits: List[Int]): List[Int] = { + plusOne(digits) + } + + def plusOne(digits: List[Int]): List[Int] = { + plusDigit(digits, 1) + } + + def plusDigit(digits: List[Int], digit: Int): List[Int] = { + val test = calc(digits.reverse, digit, Nil) + println(test) + test + } + + def calc(digits: List[Int], carry: Int, acc: List[Int]): List[Int] = { + digits match { + case Nil if carry == 0 => acc + case Nil if carry > 0 => carry::acc + case _ => { + val temp = digits.head + carry + calc(digits.tail, temp/10, temp%10::acc) + } + } + } + + def main(args: Array[String]): Unit = { + plusOne(List(1,2,3)) + } } diff --git a/src/test/scala/algorithms/array/PlusOneTest.scala b/src/test/scala/algorithms/array/PlusOneTest.scala index 0b980dabc..6ebf65750 100644 --- a/src/test/scala/algorithms/array/PlusOneTest.scala +++ b/src/test/scala/algorithms/array/PlusOneTest.scala @@ -1,10 +1,35 @@ package algorithms.array +import algorithms.UnitSpec + /** * User: before30 * Date: 2017. 5. 8. * Time: AM 9:16 */ -class PlusOneTest { +class PlusOneTest extends UnitSpec { + "PlusOne" should { + + "success1" in { + assert(PlusOne(List(1, 2, 3)) == List(1, 2, 4)) + } + + "success2" in { + assert(PlusOne(List(9, 9, 9)) == List(1, 0, 0, 0)) + } + + } + + "PlusDigit" should { + + "success1" in { + assert(PlusOne(List(1, 2, 3), 2) == List(1, 2, 5)) + } + + "success2" in { + assert(PlusOne(List(9, 9, 9), 2) == List(1, 0, 0, 1)) + } + + } } From 56de1b09113d59d2a0bbf4d3ec271b79d766b860 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 9 May 2017 20:44:38 +0900 Subject: [PATCH 3/8] Change reademe.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7a9f7c7c..b0b1138fd 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Checked implementations are written in scala. If not, those are not converted to - [longest_non_repeat](python/array/longest_non_repeat.py/) - [merge_intervals](python/array/merge_intervals.py) - [x] [MissingRanges](src/main/scala/algorithms/array/MissingRanges.scala) - - [plus_one](python/array/plus_one.py) + - [x] [plus_one](python/array/plus_one.py) - [x] [RotateArray](src/main/scala/algorithms/array/RotateArray.scala) - [summary_ranges](python/array/summary_ranges.py) - [x] [ThreeSum](src/main/scala/algorithms/array/ThreeSum.scala) From 44b16da3976285fa2ed770e84b9badcc35011a3e Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 10 May 2017 00:10:48 +0900 Subject: [PATCH 4/8] Add Parking lot reaarange algorithm --- src/main/scala/algorithms/array/Garage.scala | 91 +++++++++++++++++++ .../scala/algorithms/array/GarageTest.scala | 26 ++++++ 2 files changed, 117 insertions(+) create mode 100644 src/main/scala/algorithms/array/Garage.scala create mode 100644 src/test/scala/algorithms/array/GarageTest.scala diff --git a/src/main/scala/algorithms/array/Garage.scala b/src/main/scala/algorithms/array/Garage.scala new file mode 100644 index 000000000..34f00b7c6 --- /dev/null +++ b/src/main/scala/algorithms/array/Garage.scala @@ -0,0 +1,91 @@ +package algorithms.array + +import scala.collection.mutable + +/** + * # There is a parking lot with only one empty spot. Given the initial state +*# of the parking lot and the final state. Each step we are only allowed to +*# move a car +*# out of its place and move it into the empty spot. +*# The goal is to find out the least movement needed to rearrange +*# the parking lot from the initial state to the final state. + ** + # Say the initial state is an array: + ** + # [1,2,3,0,4], +*# where 1,2,3,4 are different cars, and 0 is the empty spot. + ** + # And the final state is + ** + # [0,3,2,1,4]. +*# We can swap 1 with 0 in the initial array to get [0,2,3,1,4] and so on. +*# Each step swap with 0 only. + ** + Example + *input : 1, 2, 3, 0, 4 + *final : 0, 3, 2, 1, 4 + ** + answer : 4 steps + ** + step 1 : 0, 2, 3, 1, 4 + *step 2 : 2, 0, 3, 1, 4 // 없으면 0 제외한 가장 앞에 것과 swap + *step 3 : 2, 3, 0, 1, 3 + *step 4 : 0, 3, 2, 1, 4 +*site : https://discuss.leetcode.com/topic/67928/rearrange-parking-lot +*site : https://www.careercup.com/question?id=5687257423937536 + * + * User: before30 + * Date: 2017. 5. 9. + * Time: PM 8:49 + */ +object Garage { + + def swap(current: List[Int], emptyIdx: Int, targetIdx: Int): List[Int] = { + current.updated(emptyIdx, current(targetIdx)).updated(targetIdx, current(emptyIdx)) + } + + def isFinished(currentGarage: List[Int], finalGarage: List[Int]): Boolean = { + currentGarage == finalGarage + } + + def calc(initGarage: scala.collection.mutable.MutableList[Int], desigredGarage: List[Int]): Int = { + var step = 0 + for ( i <- 0 until initGarage.length ) { + if (initGarage(i) != desigredGarage(i) + && desigredGarage(i) != 0) { + val indexOfZero = initGarage.indexOf(0) + if (i != indexOfZero) { + val temp = initGarage(i) + initGarage(i) = 0 + initGarage(indexOfZero) = temp + step = step + 1 + } + val indexOfTarget = initGarage.indexOf(desigredGarage(i)) + initGarage(i) = initGarage(indexOfTarget) + initGarage(indexOfTarget) = 0 + step = step + 1 + } + } + + step + } + + def getFirstDeprecntExceptZero(currentGarage: List[Int], finalGarage: List[Int]): Either[String, Int] = { + + Left("nothing") + } + + def main(args: Array[String]): Unit = { +// println(swap(List(1,2,3,4,0), 4, 0)) +// println(isFinished(List(1, 2, 3, 4, 5), List(1, 2, 3, 4, 5))) +// println(isFinished(List(1,2,3,4,5), List(2,1,3,4,5))) + +// println(calc(List(1,2,3,0), List(1,2,3,0))) + /* + input : 1, 2, 3, 0, 4 + final : 0, 3, 2, 1, 4 + + */ + println(calc(mutable.MutableList(1, 2, 3, 0, 4), List(0, 3, 2, 1, 4))) + } +} diff --git a/src/test/scala/algorithms/array/GarageTest.scala b/src/test/scala/algorithms/array/GarageTest.scala new file mode 100644 index 000000000..e63180384 --- /dev/null +++ b/src/test/scala/algorithms/array/GarageTest.scala @@ -0,0 +1,26 @@ +package algorithms.array + +import algorithms.UnitSpec + +/** + * User: before30 + * Date: 2017. 5. 9. + * Time: PM 11:19 + */ +class GarageTest extends UnitSpec { + + "Method Test" should { + "swap test" in { + assert(Garage.swap(List(1,2,3,4,0), 4, 0) == List(0,2,3,4,1)) + } + + "isFinished true" in { + assert(Garage.isFinished(List(1,2,3,4,5), List(1,2,3,4,5)) == true) + } + + "isFinished false" in { + assert(Garage.isFinished(List(1,2,3,4,5), List(1,2,3,5,4)) == false) + } + } + +} From 73afb3914ffb6a73acd51f1db49869769343bcfc Mon Sep 17 00:00:00 2001 From: Joseph Yang Date: Wed, 10 May 2017 00:10:48 +0900 Subject: [PATCH 5/8] Add Parking lot reaarange algorithm --- src/main/scala/algorithms/array/Garage.scala | 91 +++++++++++++++++++ .../scala/algorithms/array/GarageTest.scala | 26 ++++++ 2 files changed, 117 insertions(+) create mode 100644 src/main/scala/algorithms/array/Garage.scala create mode 100644 src/test/scala/algorithms/array/GarageTest.scala diff --git a/src/main/scala/algorithms/array/Garage.scala b/src/main/scala/algorithms/array/Garage.scala new file mode 100644 index 000000000..34f00b7c6 --- /dev/null +++ b/src/main/scala/algorithms/array/Garage.scala @@ -0,0 +1,91 @@ +package algorithms.array + +import scala.collection.mutable + +/** + * # There is a parking lot with only one empty spot. Given the initial state +*# of the parking lot and the final state. Each step we are only allowed to +*# move a car +*# out of its place and move it into the empty spot. +*# The goal is to find out the least movement needed to rearrange +*# the parking lot from the initial state to the final state. + ** + # Say the initial state is an array: + ** + # [1,2,3,0,4], +*# where 1,2,3,4 are different cars, and 0 is the empty spot. + ** + # And the final state is + ** + # [0,3,2,1,4]. +*# We can swap 1 with 0 in the initial array to get [0,2,3,1,4] and so on. +*# Each step swap with 0 only. + ** + Example + *input : 1, 2, 3, 0, 4 + *final : 0, 3, 2, 1, 4 + ** + answer : 4 steps + ** + step 1 : 0, 2, 3, 1, 4 + *step 2 : 2, 0, 3, 1, 4 // 없으면 0 제외한 가장 앞에 것과 swap + *step 3 : 2, 3, 0, 1, 3 + *step 4 : 0, 3, 2, 1, 4 +*site : https://discuss.leetcode.com/topic/67928/rearrange-parking-lot +*site : https://www.careercup.com/question?id=5687257423937536 + * + * User: before30 + * Date: 2017. 5. 9. + * Time: PM 8:49 + */ +object Garage { + + def swap(current: List[Int], emptyIdx: Int, targetIdx: Int): List[Int] = { + current.updated(emptyIdx, current(targetIdx)).updated(targetIdx, current(emptyIdx)) + } + + def isFinished(currentGarage: List[Int], finalGarage: List[Int]): Boolean = { + currentGarage == finalGarage + } + + def calc(initGarage: scala.collection.mutable.MutableList[Int], desigredGarage: List[Int]): Int = { + var step = 0 + for ( i <- 0 until initGarage.length ) { + if (initGarage(i) != desigredGarage(i) + && desigredGarage(i) != 0) { + val indexOfZero = initGarage.indexOf(0) + if (i != indexOfZero) { + val temp = initGarage(i) + initGarage(i) = 0 + initGarage(indexOfZero) = temp + step = step + 1 + } + val indexOfTarget = initGarage.indexOf(desigredGarage(i)) + initGarage(i) = initGarage(indexOfTarget) + initGarage(indexOfTarget) = 0 + step = step + 1 + } + } + + step + } + + def getFirstDeprecntExceptZero(currentGarage: List[Int], finalGarage: List[Int]): Either[String, Int] = { + + Left("nothing") + } + + def main(args: Array[String]): Unit = { +// println(swap(List(1,2,3,4,0), 4, 0)) +// println(isFinished(List(1, 2, 3, 4, 5), List(1, 2, 3, 4, 5))) +// println(isFinished(List(1,2,3,4,5), List(2,1,3,4,5))) + +// println(calc(List(1,2,3,0), List(1,2,3,0))) + /* + input : 1, 2, 3, 0, 4 + final : 0, 3, 2, 1, 4 + + */ + println(calc(mutable.MutableList(1, 2, 3, 0, 4), List(0, 3, 2, 1, 4))) + } +} diff --git a/src/test/scala/algorithms/array/GarageTest.scala b/src/test/scala/algorithms/array/GarageTest.scala new file mode 100644 index 000000000..e63180384 --- /dev/null +++ b/src/test/scala/algorithms/array/GarageTest.scala @@ -0,0 +1,26 @@ +package algorithms.array + +import algorithms.UnitSpec + +/** + * User: before30 + * Date: 2017. 5. 9. + * Time: PM 11:19 + */ +class GarageTest extends UnitSpec { + + "Method Test" should { + "swap test" in { + assert(Garage.swap(List(1,2,3,4,0), 4, 0) == List(0,2,3,4,1)) + } + + "isFinished true" in { + assert(Garage.isFinished(List(1,2,3,4,5), List(1,2,3,4,5)) == true) + } + + "isFinished false" in { + assert(Garage.isFinished(List(1,2,3,4,5), List(1,2,3,5,4)) == false) + } + } + +} From c55d9a3635ec24294465dc442d33d7d3659b12cc Mon Sep 17 00:00:00 2001 From: before30 Date: Mon, 15 May 2017 21:49:09 +0900 Subject: [PATCH 6/8] Add LongestSubstring --- README.md | 4 +- python/array/garage.py | 49 ------------------- python/array/plus_one.py | 38 -------------- .../algorithms/array/LongestSubstring.scala | 20 ++++++++ 4 files changed, 22 insertions(+), 89 deletions(-) delete mode 100644 python/array/garage.py delete mode 100644 python/array/plus_one.py create mode 100644 src/test/scala/algorithms/array/LongestSubstring.scala diff --git a/README.md b/README.md index b0b1138fd..6ad7e4918 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ Checked implementations are written in scala. If not, those are not converted to - [array](src/main/scala/algorithms/array) - [x] [CircularCounter](src/main/scala/algorithms/array/CircularCounter.scala) - [x] [Flatten](src/main/scala/algorithms/array/Flatten.scala) - - [garage](python/array/garage.py) + - [x] [garage](src/main/scala/algorithms/array/Garage.scala) - [longest_non_repeat](python/array/longest_non_repeat.py/) - [merge_intervals](python/array/merge_intervals.py) - [x] [MissingRanges](src/main/scala/algorithms/array/MissingRanges.scala) - - [x] [plus_one](python/array/plus_one.py) + - [x] [plus_one](src/main/scala/algorithms/array/PlusOne.scala) - [x] [RotateArray](src/main/scala/algorithms/array/RotateArray.scala) - [summary_ranges](python/array/summary_ranges.py) - [x] [ThreeSum](src/main/scala/algorithms/array/ThreeSum.scala) diff --git a/python/array/garage.py b/python/array/garage.py deleted file mode 100644 index 88d1318f5..000000000 --- a/python/array/garage.py +++ /dev/null @@ -1,49 +0,0 @@ -# There is a parking lot with only one empty spot. Given the initial state -# of the parking lot and the final state. Each step we are only allowed to -# move a car -# out of its place and move it into the empty spot. -# The goal is to find out the least movement needed to rearrange -# the parking lot from the initial state to the final state. - -# Say the initial state is an array: - -# [1,2,3,0,4], -# where 1,2,3,4 are different cars, and 0 is the empty spot. - -# And the final state is - -# [0,3,2,1,4]. -# We can swap 1 with 0 in the initial array to get [0,2,3,1,4] and so on. -# Each step swap with 0 only. -#Edited by cyberking-saga - -def garage(beg, end): - i = 0 - moves = 0 - while beg != end: - if beg[i] != 0 and beg[i] != end[i]: - car = beg[i] - empty = beg.index(0) - final_pos = end.index(beg[i]) - if empty != final_pos: - beg[final_pos], beg[empty] = beg[empty], beg[final_pos] - print(beg) - empty = beg.index(0) - beg[beg.index(car)], beg[empty] = beg[empty], beg[beg.index(car)] - print(beg) - moves += 2 - else: - beg[beg.index(car)], beg[empty] = beg[empty], beg[beg.index(car)] - print(beg) - moves += 1 - i += 1 - if i == len(beg): - i = 0 - return moves - -if __name__ == "__main__": - initial = [1,2,3,0,4] - final = [0,3,2,1,4] - print("initial:", initial) - print("final:", final) - print(garage(initial, final)) diff --git a/python/array/plus_one.py b/python/array/plus_one.py deleted file mode 100644 index 8d47b0827..000000000 --- a/python/array/plus_one.py +++ /dev/null @@ -1,38 +0,0 @@ -# Given a non-negative number represented as an array of digits, -# plus one to the number. - -# The digits are stored such that the most significant -# digit is at the head of the list. - - -def plusOne(digits): - """ - :type digits: List[int] - :rtype: List[int] - """ - digits[-1] = digits[-1] + 1 - res = [] - ten = 0 - i = len(digits)-1 - while i >= 0 or ten == 1: - sum = 0 - if i >= 0: - sum += digits[i] - if ten: - sum += 1 - res.append(sum % 10) - ten = sum / 10 - i -= 1 - return res[::-1] - - -def plus_one(digits): - n = len(digits) - for i in range(n-1, -1, -1): - if digits[i] < 9: - digits[i] += 1 - return digits - digits[i] = 0 - new_num = [0] * (n+1) - new_num[0] = 1 - return new_num diff --git a/src/test/scala/algorithms/array/LongestSubstring.scala b/src/test/scala/algorithms/array/LongestSubstring.scala new file mode 100644 index 000000000..25b3f305d --- /dev/null +++ b/src/test/scala/algorithms/array/LongestSubstring.scala @@ -0,0 +1,20 @@ +package algorithms.array + +/** + * User: before30 + * Date: 2017. 5. 10. + * Time: PM 12:02 + * + * Difficulty : Medium + * Given a string, find the length of the longest substring without repeating characters. + * + * Examples: + * Given "abcabcbb", the answer is "abc", which the length is 3. + * Given "bbbbb", the answer is "b", with the length of 1. + * Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring. + * + * site : https://leetcode.com/problems/longest-substring-without-repeating-characters/#/description + */ +object LongestSubstring { + +} From b7595ab2380c9d9b409764f05c1d424e072c87bb Mon Sep 17 00:00:00 2001 From: before30 Date: Tue, 16 May 2017 22:06:32 +0900 Subject: [PATCH 7/8] Add addBinary --- .../scala/algorithms/string/AddBinary.scala | 48 +++++++++++++++++++ .../algorithms/string/AddBinaryTest.scala | 36 ++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 src/main/scala/algorithms/string/AddBinary.scala create mode 100644 src/test/scala/algorithms/string/AddBinaryTest.scala diff --git a/src/main/scala/algorithms/string/AddBinary.scala b/src/main/scala/algorithms/string/AddBinary.scala new file mode 100644 index 000000000..17f9e7ddc --- /dev/null +++ b/src/main/scala/algorithms/string/AddBinary.scala @@ -0,0 +1,48 @@ +package algorithms.string + +/** + * Created by before30 on 16/05/2017. + */ + +/* +Given two binary strings, +return their sum (also a binary string). + +For example, + a = "11" + b = "1" +Return "100". +*/ + +object AddBinary { + + // "1111", "1" -> 10000 + + def add(list1: List[Int], list2: List[Int], carry: Int, acc: List[Int]): List[Int] = { + if (list1.isEmpty && list2.isEmpty && carry != 0) carry::acc + else if(list1.isEmpty && list2.isEmpty && carry == 0) acc + else { + val (h1, t1) = if (!list1.isEmpty) (list1.head, list1.tail) else (0, Nil) + val (h2, t2) = if (!list2.isEmpty) (list2.head, list2.tail) else (0, Nil) + val c1 = (h1 + h2 + carry) / 2 + val v = (h1 + h2 + carry) % 2 + add(t1, t2, c1, v :: acc) + } + + + } + def apply(a: String, b: String): String = { + + add(a.toList.map(x => x - '0').reverse, b.toList.map(x => x - '0').reverse, 0, Nil).mkString("") + } + + def main(args: Array[String]): Unit = { + println("10000 == " + AddBinary("1111", "1")) + println("0 == " + AddBinary("0", "0")) + println("10 == " + AddBinary("1", "1")) + println("10000000001 == " + AddBinary("10000000000", "1")) + println("10000 == " + AddBinary("1101", "11")) + println("10000 ==" + AddBinary("1", "1111")) + println("101 ==" + AddBinary("001", "100")) + } +} diff --git a/src/test/scala/algorithms/string/AddBinaryTest.scala b/src/test/scala/algorithms/string/AddBinaryTest.scala new file mode 100644 index 000000000..eace306b1 --- /dev/null +++ b/src/test/scala/algorithms/string/AddBinaryTest.scala @@ -0,0 +1,36 @@ +package algorithms.string + +import algorithms.UnitSpec + +/** + * Created by before30 on 16/05/2017. + */ +class AddBinaryTest extends UnitSpec { + "AddBinary" when { + "1111, 1" in { + assert(AddBinary("1111", "1") == "10000") + } + + "0, 0" in { + assert(AddBinary("1111", "1") == "10000") + } + + "1, 1" in { + assert(AddBinary("1", "1") == "10") + } + + "1101, 11" in { + assert(AddBinary("1101", "11") == "10000") + } + + "1, 1111" in { + assert(AddBinary("1", "1111") == "10000") + + } + + "001, 100" in { + assert(AddBinary("001", "100") == "101") + } + } + +} From 4e27564d4b89a52edf279581a10bc77a420d40ef Mon Sep 17 00:00:00 2001 From: before30 Date: Tue, 16 May 2017 22:07:35 +0900 Subject: [PATCH 8/8] Change README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ad7e4918..3f105bf55 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ Checked implementations are written in scala. If not, those are not converted to - [stack](python/stack/stack.py) - [valid_parenthesis](python/stack/valid_parenthesis.py) - [string](python/string) - - [add_binary](python/string/add_binary.py) + - [x] [add_binary](src/main/scala/algorithms/string/AddBinary.scala) - [breaking_bad](python/string/breaking_bad.py) - [decode_string](python/string/decode_string.py) - [encode_decode](python/string/encode_decode.py)