Skip to content

Instantly share code, notes, and snippets.

View lon-io's full-sized avatar

Excellence Ilesanmi lon-io

View GitHub Profile
@lon-io
lon-io / reverse.py
Created May 5, 2017 06:21
Python script to reverse a given string
# Reverse a given string
def reverse(str):
l = []
for index, i in enumerate(str):
j = len(str)-1 - index
l.append(str[j])
return ''.join(l)
print reverse("asdaad")
@lon-io
lon-io / Unique.java
Created May 5, 2017 06:20
Java class with a fucntion to determine the number of unique strings in an array of strings
public class Unique{
public static void main(String [] args){
Unique unique = new Unique();
String[] _args = {"as", "as", "se", "so","so","an","no"};
System.out.println(unique.det(_args));
}
public int det(String [] args_){
@lon-io
lon-io / anagram.py
Created May 5, 2017 06:17
Python function to determine if two words are Anagrams of each other
# Determine if an index has been checked
def index_not_in(list_of_indices, index):
res = True
for i in list_of_indices:
if index == i:
res = False
return res
# Determine if 2 strings are anagrams
def anagram(str1, str2):
@lon-io
lon-io / GZipRequest.java
Created October 31, 2015 18:56 — forked from premnirmal/GZipRequest.java
Parse GZip responses using volley
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.StringRequest;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;