This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hackoranko | |
object LookAndSay { | |
def LookAndSay(start: String, n: Int): String = { | |
var first = start(0) | |
var tmpStart = new StringBuilder(start(0).toString() + "1") | |
for (t <- start.tail) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algo; | |
public class Score { | |
public static void main(String[] args) { | |
String[] nums = { "5", "-2", "4", "Z", "X", "9", "+", "+" }; // 27 | |
// String[] nums = { "1", "2", "4", "Z"}; // 3 | |
System.out.println(findScore(nums, nums.length)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package algo; | |
public class LinkedListReverse { | |
public static void main(String[] args) throws Exception { | |
Node<Integer> node = new Node(1); | |
node.next = new Node(2); | |
node.next.next = new Node(3); | |
node.next.next.next = new Node(4); | |
node.next.next.next.next = new Node(5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class Pascal { | |
public static void main(String[] args) { | |
int numberOfRows = 8; | |
String blank = " "; | |
List<List<Integer>> listOfList = new ArrayList<>(); |
OlderNewer