Skip to content

Instantly share code, notes, and snippets.

View sumaiyaasif's full-sized avatar

Sumaiya Asif sumaiyaasif

  • Signifyd
View GitHub Profile
@sumaiyaasif
sumaiyaasif / ArrayDeletion.py
Created April 16, 2018 18:29
Answer to cassidoo interview question for 4.9.2018
# Given an unsorted array arr and a number n,
# delete all numbers in arr that are greater than n.
arr = [3,4,6,1,8,2,6,7,10]
num = 7
def deleteElements(arr, num):
for x in arr:
if x > num:
arr.remove(x)
@sumaiyaasif
sumaiyaasif / MinimumDiff.py
Created February 24, 2018 18:45
Cassidoo Interview Question of 2/19/18
# Given an unsorted array arr, find the minimum difference between any pair in arr.
# Example:
# > minimumDiff([130, 5, 20, 9])
# > 4
def minimumDiff(arr):
minimum = abs(arr[0] - arr[1])
for i in range(len(arr)):
for j in range(i+1, len(arr)):