Skip to content

Instantly share code, notes, and snippets.

View sicknarlo's full-sized avatar

Nick Sarlo sicknarlo

  • Philadelphia, PA
View GitHub Profile
@sicknarlo
sicknarlo / altchar
Created December 17, 2014 15:28
[HackerRank] Alternating Characters
/* Shashank likes strings in which consecutive characters are different. For example,
he likes ABABA, while he doesn't like ABAA. Given a string containing characters A and
B only, he wants to change it into a string he likes. To do this, he is allowed to
delete the characters in the string.
Your task is to find the minimum number of required deletions. */
#include<iostream>
#include<string>
@sicknarlo
sicknarlo / utopiantree
Created December 17, 2014 15:27
[HackerRank] Utopian Tree
/* The Utopian tree goes through 2 cycles of growth every year. The first growth cycle occurs during the spring,
when it doubles in height. The second growth cycle occurs during the summer, when its height increases by 1 meter.
Now, a new Utopian tree sapling is planted at the onset of the spring. Its height is 1 meter. Can you find the
height of the tree after N growth cycles? */
#include<iostream>
#include<vector>
using namespace std;
@sicknarlo
sicknarlo / finddigits
Created December 17, 2014 15:26
[HackerRank] Find Digits
/* You are given an integer N. Find the digits in this number that exactly divide N and display their count.
For N = 24, there are 2 digits - 2 & 4. Both these digits exactly divide 24. So our answer is 2. */
#include<iostream>
#include<string>
using namespace std;
int main(){

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
""" Quicksort implementation """
def quicksort(arr):
""" Quicksort a list
:type arr: list
:param arr: List to sort
:returns: list -- Sorted list
"""