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
using System; | |
// Determine whether a circular array of relative indices is composed | |
// of a single complete cycle | |
// ToDO - Do it O(1) space | |
namespace SingleCompleteCycle | |
{ | |
public class Program | |
{ |
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
using System; | |
namespace SortedDoubleLinkedList | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var sortedList = new SortedDoubleLinkedList(); | |
sortedList.Add(5); |
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
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 | |
{ |
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
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 |
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
using System; | |
using System.Collections.Generic; | |
// https://www.interviewcake.com/question/rectangular-love | |
// Find overlap between 2 rectangles | |
namespace intersectionRectangles | |
{ | |
public class Program | |
{ |
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
using System; | |
using System.Collections.Generic; | |
// Implement a queue using two stacks | |
namespace QueueUsingStacks | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) |
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
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. |
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
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); |
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
using System; | |
using System.Collections.Generic; | |
namespace AllCombinationsForMakingChange | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var amount = 8; |
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
using System; | |
using System.Collections.Generic; | |
namespace LRUCache | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
int totalNumberOfGames = 4; |