Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Working from home

Shlomi ShlomiRex

🏆
Working from home
View GitHub Profile
View HackerRank-Maze-Escape-Solution.java
import java.io.*;
import java.util.*;
public class Solution {
static Random rnd;
//True - if not wall. False - if wall.
static boolean[] directions = {false,false,false,false};
static String line;
static Scanner s = new Scanner(System.in);
@ShlomiRex
ShlomiRex / My Bin Search
Created Feb 25, 2017
Search through sorted list (ascending) By given number, find the position where the number should go. Example given array: { 1, 3, 5, 7 } Number 6 will go after index 2. (after 5 and before 7) NOTE: Array must be sorted. (Not checking) NOTE: This is my algorithm. It might not be efficient but I think its doing the job. Complexity Big-O : O(lg n)
View My Bin Search
View Array-Left-Rotation.java
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
//initializing regular code...
Scanner s = new Scanner(System.in);
int n = s.nextInt();