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
(defn fib | |
([n] | |
(fib n 0 1 0) ) | |
([n start prev acc] | |
(if (= n start) | |
acc | |
(fib n (inc start) acc (+ prev acc ) ) | |
) | |
) | |
) |
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.io.DataInputStream; | |
import java.io.DataOutputStream; | |
import java.io.IOException; | |
import java.net.Socket; | |
import java.util.Scanner; | |
public class ClientService { | |
Socket socket = null; | |
DataInputStream dis = null; |
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
public class FindReverse { | |
public static void main(String[] args) { | |
String longWord = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincr |
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 teach; | |
import java.util.Arrays; | |
public class FindAnagram { | |
/** | |
* Develop code that would match words as anagram. If they are anagram | |
* your code will change last element of each index from null to "T", else "F". | |
* And print the results. | |
* E.g. Tea and Eat, ate are anagram words. |
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 teach; | |
public class ProjectEulerProblem4 { | |
/** | |
* A palindromic number reads the same both ways. The largest palindrome made | |
* from the product of two 2-digit numbers is 9009 = 91 x 99. | |
* Find the largest palindrome made from the product of two 3-digit numbers. | |
*/ | |
private static final int MAX = 999; |
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 teach; | |
public class FindBalance { | |
/** | |
* write a recursion function that will state a given string has balanced | |
* parenthesis. | |
*/ | |
public static void main(String[] args) { | |
String[][] words = { |
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 teach; | |
public class MirrorsEnd { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
String[] words = { "abXYZba", "abca", "aba", "Hi and iH", "123and then 321" }; |
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 learn; | |
public class MiddleWordSwap { | |
public static void main(String[] args) { | |
char[] str = "Java is nice but Scala is even better :)".toCharArray(); | |
char[] goal = "Java is nice but :) is even better Scala".toCharArray(); | |
System.out.println("Original: '" + new String(str) + "'"); | |
str = rearrange(str); |
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 oasis; | |
public class Tree { | |
public Student head = null; | |
public void add(Integer number, String name, String surname) { | |
Student student = new Student(number, name, surname); | |
if (head == null) { | |
head = student; | |
} else { |
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 | |
class Roman(kings: Array[String]) { | |
val basicLetters = Map( | |
'I' -> 1, | |
'V' -> 5, | |
'X' -> 10, | |
'L' -> 50, | |
'C' -> 100, |
OlderNewer