Skip to content

Instantly share code, notes, and snippets.

/**
* Created by xynophon on 15.1.13.
*/
import java.util.Random;
public class max_sum {
public double max(double i, double j){
if(i == j)return i;
return (i<j)?j:i;
}
/**
* Created by xynophon on 15.1.13.
*/
import java.util.Random;
public class sort {
public double[] swap(double[] arr, int i, int j){
double temp = arr[i];
arr[i] = arr[j];
/**
* Created by xynophon on 15.1.12.
*/
import java.util.Random;
import java.util.Scanner;
public class moving_Average {
// O(n^2)
public void solution(double[] weights, int num_ma){
for(int cnt = 0; cnt <= weights.length-num_ma; cnt++){
/**
* Created by xynophon on 15.1.13.
*/
public class binary_search {
public int binary_search(double[] arr, double target){
int lo = 0;
int hi = arr.length;
while(lo+1 < hi){
int mid = (lo+hi)/2;
import java.util.Scanner;
/**
* Created by xynophon on 15.1.13.
*/
public class FactorialTrailingZeroes {
public long trailingZeroes(int n) {
int count = 0;
if(n < 1) return 0;
import java.util.Scanner;
/**
* Created by xynophon on 15.1.14.
*/
public class Excelsheetcolumnnumber {
public int titleToNumber(String s) {
int num = s.charAt(0)-64;
for(int i = 1; i < s.length(); i++){
num = 26 * num + (s.charAt(i)-64);
@xynophon
xynophon / EditAACUnit.java
Last active July 10, 2017 05:42
VoiceRecorder edit recorded file
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.HashMap;
import android.util.Log;
@xynophon
xynophon / sort.java
Last active September 21, 2018 00:00
/**
* Created by xynophon on 15.1.17.
*/
import java.util.Random;
import java.util.Scanner;
public class sort {
public int[] swap(int[] arr, int i, int j){
int temp = arr[i];
arr[i] = arr[j];
/**
* Created by xynophon on 15.1.17.
*/
import java.util.Scanner;
public class search {
public int binary_search_iter(int[] arr, int target){
int lo = 0;
int hi = arr.length;
import java.util.Scanner;
/**
* Created by xynophon on 15.1.27.
*/
public class Unique_Binary_Search_Trees {
public int solution(int n){
int dbnum = 2*n;
long result = 1;
int cnt = 0;