Skip to content

Instantly share code, notes, and snippets.

@pandey-adarsh147
pandey-adarsh147 / gist:8188884
Created December 30, 2013 21:55
Generate all permutation of a string
public class GenerateAllPermutation {
public static void main(String... arg) {
Scanner scanner = new Scanner(System.in);
String sequence = scanner.nextLine();
generatePermutation("", sequence);
}
private static void generatePermutation(String prefix, String sequence) {
@pandey-adarsh147
pandey-adarsh147 / GeneratePermutation2Strings.java
Created January 1, 2014 14:34
Generate permutation of 2 string in ordered form
public class GeneratePermutation2Strings {
public static void main(String... arg) {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.nextLine();
String s2 = scanner.nextLine();
generateSequence("", s1, s2);
}
@pandey-adarsh147
pandey-adarsh147 / EuclidAlgo.java
Created January 6, 2014 15:45
Euclid's Algorithm for GCD
public class EuclidAlgo {
public static void main(String ...arg) {
Scanner scanner = new Scanner(System.in);
int m = scanner.nextInt();
int n = scanner.nextInt();
System.out.println("GCD: "+ gcd(m, n));
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_alignParentTop="true"
android:id="@+id/mapfragment"
android:layout_width="match_parent"
android:layout_height="300dp"
@pandey-adarsh147
pandey-adarsh147 / LRUCache.java
Created January 12, 2015 20:32
LRUCache main class
package com.vectordirection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
/**
* Created by adarshpandey on 1/12/15.
@pandey-adarsh147
pandey-adarsh147 / CacheableItem.java
Created January 12, 2015 20:34
Cacheable Item for LRU
package com.vectordirection;
/**
* Created by adarshpandey on 1/12/15.
*/
public interface CacheableItem<Key> {
Key getKey();
}
@pandey-adarsh147
pandey-adarsh147 / CachingTest.java
Created January 12, 2015 20:36
LRU unit test cases
package com.verctordirection.test;
import com.vectordirection.LRUCache;
import org.junit.Test;
/**
* Created by adarshpandey on 1/13/15.
*/
public class CachingTest {
@pandey-adarsh147
pandey-adarsh147 / Store.java
Created January 12, 2015 20:37
Cacheable Store class
package com.verctordirection.test;
import com.vectordirection.CacheableItem;
/**
* Created by adarshpandey on 1/13/15.
*/
public class Store implements CacheableItem<Integer> {
private Integer key;
@pandey-adarsh147
pandey-adarsh147 / HelloService.proto
Last active December 8, 2019 16:05
Hello service proto file
syntax = "proto3";
option java_multiple_files = true;
package com.gonuclei.grpc;
option java_package = "com.gonuclei.grpc";
message HelloRequest {
string first_name = 1;
string lastName = 2;
}