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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package com.mycompany.jgitplayground; | |
import java.io.File; | |
import java.io.IOException; | |
import org.eclipse.jgit.lib.Repository; |
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 com.company; | |
public class Main { | |
String str; | |
String compStr; | |
Main(String str){ | |
this.str=str; | |
} | |
//Str => aaaabbcdddddeeeeeeffffghhhhh | |
String compress(){ |
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.*; | |
import java.util.concurrent.ConcurrentHashMap; | |
/** | |
* Created by rohit on 2/1/16. | |
* Program to implement LRU algorithm. | |
* Min value priority : Indicates lease recently used. | |
* Max value priority: Indicates recently used. | |
* I Hit 2 Hit 1 Hit 3 Hit 2 Miss 6 | |
* |1 1| |1 0| |1 3| |1 2| |1 1| |6 3| |
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 com.company; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
public class Main { | |
private int V; //number of vertices. | |
private LinkedList<Integer> adj[]; | |
//Constructor that inialises and sets memory for the adj list | |
Main(int v){ |
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 GauvaDemo; | |
import static com.google.common.base.Preconditions.*; | |
import com.google.common.base.*; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Just a snippet on Optional and usage of Preconditions in Guava. | |
* |
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 Observer; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
/** | |
* Observer design pattern | |
*/ | |
interface Observer{ |
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
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) | |
(when (not package-archive-contents) | |
(package-refresh-contents)) | |
(defvar myPackages |
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 PrimeSum { | |
static boolean isPrime(Integer x){ | |
if(x==2) | |
return true; | |
if(x%2==0) | |
return false; | |
for(Integer j=2;j<=Math.sqrt(x);j++){ | |
if(x%j==0) | |
return false; |
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 com.company; | |
//import java.util.ArrayList; | |
//import java.util.List; | |
//class GenerateRandom{ | |
// int range; | |
// List<Integer> randomNumbers; | |
// GenerateRandom(int rangeMin,int rangeMax){ | |
// randomNumbers= new ArrayList<>(); | |
// for(int i=0;i<200;i++){ | |
// randomNumbers.add((int)(Math.random()*(rangeMax-rangeMin))); |
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
(ns overtone.core) | |
(use 'overtone.live) | |
(use 'overtone.inst.piano) | |
(defn fibn | |
"Find nth fibonacii number" | |
[n] | |
(loop [index 0 x 1 y 1] | |
(if (= index n) | |
y |
OlderNewer