Skip to content

Instantly share code, notes, and snippets.

View VegaFromLyra's full-sized avatar

Asha Balasubramaniam VegaFromLyra

View GitHub Profile
using System;
namespace PaintFill
{
public class Program
{
public static void Main(string[] args)
{
Point [,] canvas = {
{ new Point(0, 0, Color.Red), new Point(0, 1, Color.Red) },
using System;
using System.Collections.Generic;
namespace LRUCache
{
public class Program
{
public static void Main(string[] args)
{
int totalNumberOfGames = 4;
@VegaFromLyra
VegaFromLyra / changeCombinations
Last active August 29, 2015 14:22
All unique combinations to make change for a given amount
using System;
using System.Collections.Generic;
namespace AllCombinationsForMakingChange
{
public class Program
{
public static void Main(string[] args)
{
var amount = 8;
@VegaFromLyra
VegaFromLyra / nthFibonacci
Created June 1, 2015 22:34
Nth fibonacci
using System;
namespace NthFibonacci
{
public class Program
{
public static void Main(string[] args)
{
int n = 4;
Console.WriteLine("{0}th fibonacci is {1}, Expected {2}", n, nthFibonacci(n), 3);
using System;
using System.Collections.Generic;
using System.Text;
namespace validPhrases
{
/*
You're given a dictionary array of 50k valid words, called myDictionary. You are then
given a string of characters as input. Write a function that takes that string and
checks whether or not the characters you've received so far form a set of words.
@VegaFromLyra
VegaFromLyra / queue_2_stacks
Created June 2, 2015 22:00
Build a queue using 2 stacks
using System;
using System.Collections.Generic;
// Implement a queue using two stacks
namespace QueueUsingStacks
{
public class Program
{
public static void Main(string[] args)
@VegaFromLyra
VegaFromLyra / rectangleOverlap
Last active August 29, 2015 14:22
Overlapping rectangles
using System;
using System.Collections.Generic;
// https://www.interviewcake.com/question/rectangular-love
// Find overlap between 2 rectangles
namespace intersectionRectangles
{
public class Program
{
@VegaFromLyra
VegaFromLyra / marbles
Created June 6, 2015 22:11
Bag of marbles
using System;
using System.Collections.Generic;
// Say you have a bag of marbles. The marbles can
// either be Yellow, Blue of Green.
// Implement Add, Get operations from this bag
// The 'Get' method should be a weighted random operation
// aka if there are more blue marbles then there should be
// a higher probability of picking a blue on
@VegaFromLyra
VegaFromLyra / generateRandomStock
Created June 6, 2015 23:00
Random weighted stock
using System;
using System.Collections.Generic;
// generateRandomStock: Generate a random stock weighted according to the value of the stock
//
// key: Stock Name
// Value: The number of times this stock is traded in a given day
namespace generateRandomStock
{
@VegaFromLyra
VegaFromLyra / sortedDoubleLinkedList
Created June 6, 2015 23:50
Insert items into double linked list in sorted order
using System;
namespace SortedDoubleLinkedList
{
public class Program
{
public static void Main(string[] args)
{
var sortedList = new SortedDoubleLinkedList();
sortedList.Add(5);