Skip to content

Instantly share code, notes, and snippets.

View quangnguyenbh's full-sized avatar

Quang Nguyen quangnguyenbh

View GitHub Profile
deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu trusty main
@quangnguyenbh
quangnguyenbh / TheSumOfThree.rb
Last active December 17, 2015 19:09
Q. Write a O(N^2) function that takes as input an array of N integers, return a bool to indicate whether there are three integers in the array such that the sum of the three is zero.
1. Sort the array A[1..n] incrementally.
2.
process ( A[1..n])
begin
if(n < 3)
return false
else if (A[1] > 0 or A[n] < 0 )
return false
else if (A[1] + 2A[n] < 0)
return process(A[2..n])
BOOL APCheckIfAppInstalled(NSString *bundleIdentifier)
{
static NSString *const cacheFileName = @"com.apple.mobile.installation.plist";
NSString *relativeCachePath = [[@"Library" stringByAppendingPathComponent: @"Caches"] stringByAppendingPathComponent: cacheFileName];
NSDictionary *cacheDict = nil;
NSString *path = nil;
// Loop through all possible paths the cache could be in
for (short i = 0; 1; i++)
{