Skip to content

Instantly share code, notes, and snippets.

View vasundhar's full-sized avatar
🏠
Working from home

Vasundhar Boddapati vasundhar

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am vasundhar on github.
  • I am vasundhar (https://keybase.io/vasundhar) on keybase.
  • I have a public key whose fingerprint is A437 9A47 F683 35C9 BF01 925A F742 27F2 EA97 F597

To claim this, I am signing this object:

@vasundhar
vasundhar / server.r
Created March 7, 2014 07:37 — forked from wch/server.r
if (!require(quantmod)) {
stop("This app requires the quantmod package. To install it, run 'install.packages(\"quantmod\")'.\n")
}
# Download data for a stock if needed, and return the data
require_symbol <- function(symbol, envir = parent.frame()) {
if (is.null(envir[[symbol]])) {
envir[[symbol]] <- getSymbols(symbol, auto.assign = FALSE)
}
@vasundhar
vasundhar / gist:2052205
Created March 16, 2012 19:51 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@vasundhar
vasundhar / Hint.md
Created March 8, 2012 01:57 — forked from yuvipanda/Hint.md
Palindrome Solution (InterviewStreet CodeSprint Fall 2011)

Considering each permutation of the letters as a variable, we get a number of simultaneous equations which can be solved using Gaussian Elimination to compute the expected value of each permutation. However, the number of variables is very large. This can be reduced by making the observation that many states such as "abab" and "baba" are essentially the same since the letters in them are simply relabelled. Thus we can normalize each string by letting it start with an 'a', replacing the next occuring character with a 'b' and so on. For example, string "paddpa" would be normalized to "abccab". This reduces the number of variables greatly, and also helps us efficiently memoize across various test cases. Also, we should note that running one Gaussian Elimination gives us the expected values for many states (and not just one), all of which should be saved for future reference.