This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/aman/.rvm/rubies/ruby-2.2.3/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/aman/RubymineProjects/FPForTheIntrigued/main.rb | |
https://weather.yahooapis.com/forecastrss?w=2391271 | |
Denver | |
OH | |
37 | |
https://weather.yahooapis.com/forecastrss?w=2391272 | |
https://weather.yahooapis.com/forecastrss?w=2391273 | |
Denver | |
OK | |
55 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = [1, 2, 3, 4, 5, 6] | |
totalBad = 0 | |
for element in numbers | |
totalBad += element | |
end | |
# puts totalBad |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pOrder(s1, s2, acc) { | |
if (s1.length == 0 && s2.length == 0) { | |
console.log(acc); | |
} | |
if (s1.length != 0) { | |
acc.push(s1.pop()); | |
pOrder(s1, s2, acc); | |
s1.push(acc.pop()); | |
} | |
if (s2.length != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <climits> | |
#include <stack> | |
typedef struct Holder { | |
Node* node; | |
int min; | |
int max; | |
Holder(Node* n, int min, int max): node(n), min(min), max(max) {} | |
} *Holder_p; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <climits> | |
// Cracking the Coding Interview, Question 4.5 | |
// Implement a function to check if a binary tree is a binary search tree | |
// One-liner version | |
bool isSearch(Node* root, int max = INT_MAX, int min = INT_MIN) { | |
return (!root) | |
|| ( | |
!(root->value <= min) | |
&& !(root->value > max) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final int getAndIncrement(int i) { | |
while (true) { | |
int current = get(i); | |
int next = current + 1; | |
if (compareAndSet(i, current, next)) | |
return current; | |
} | |
} | |
//So this is how the AtomicIntegerArray implements getAndIncrement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family: 'Raleway'; | |
font-style: normal; | |
font-weight: 100; | |
src: url(https://github.com/theleagueof/raleway/raw/master/webfonts/raleway_thin-webfont.ttf) format('truetype'); | |
} | |
@font-face { | |
font-family: 'Raleway'; | |
font-style: normal; | |
font-weight: 300; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<cstring> | |
using namespace std; | |
const int MAX_WORD_LEN = 100; | |
const int TOTAL_LIVES = 10; | |
int find_len( const char word[] ); | |
void clear_screen(); |