This file contains hidden or 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 scala.collection.mutable | |
| /** | |
| * Created by roger on 6/17/14. | |
| */ | |
| object Solution { | |
| val stack = mutable.Stack[Character]() | |
| def main(args: Array[String]) { |
This file contains hidden or 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 scala.collection.mutable | |
| /** | |
| * Created by roger on 6/17/14. | |
| */ | |
| object Solution { | |
| val stack = mutable.Stack[Character]() | |
| def main(args: Array[String]) { |
This file contains hidden or 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 main | |
| import ( | |
| "fmt" | |
| "math" | |
| ) | |
| func Sqrt(x float64) float64 { | |
| z := float64(1); | |
| old := float64(3); |
This file contains hidden or 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.Random; | |
| public class CodingInterview { | |
| public static void swap(int[] array, int src, int dest){ | |
| int temp = array[dest]; | |
| array[dest] = array[src]; | |
| array[src] = temp; | |
| } |
This file contains hidden or 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
| //simple Josephus function | |
| public static int jP(int n, int k){ | |
| if(n == 1){ | |
| return 1; | |
| }else{ | |
| return ((jP(n - 1, k) + k - 1) % n) + 1; | |
| } | |
| } |