Skip to content

Instantly share code, notes, and snippets.

View VegaFromLyra's full-sized avatar

Asha Balasubramaniam VegaFromLyra

View GitHub Profile
@VegaFromLyra
VegaFromLyra / isSCC
Created June 9, 2015 01:30
Single complete cycle
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
{
@VegaFromLyra
VegaFromLyra / Project.json
Created June 10, 2015 20:05
Project.json for VSCode console app
{
"version": "1.0.0-*",
"dependencies": {
"System.ServiceModel.Web": "1.0.0"
},
"commands": {
"run": "run"
},
"frameworks": {
"dnx451": {},
@VegaFromLyra
VegaFromLyra / inPlaceShuffle
Created June 11, 2015 18:16
In place shuffle
using System;
namespace InplaceShuffle
{
public class Program
{
public static void Main(string[] args)
{
var arr = new int[]{1, 2, 3, 4, 5};
shuffle(arr);
@VegaFromLyra
VegaFromLyra / condense_meeting_times
Created June 15, 2015 00:38
Condense Meeting Times
// https://www.interviewcake.com/question/merging-ranges
using System;
using System.Collections.Generic;
using System.Linq;
namespace MeetingTimes
{
public class Program
{
@VegaFromLyra
VegaFromLyra / OO_Battleship
Created June 15, 2015 01:07
Design Batteship
class Battleship {
Player currentPlayer;
Player opponetPlayer;
Player player1;
Player player2;
@VegaFromLyra
VegaFromLyra / EditDistance
Created June 28, 2015 22:19
Edit Distance
using System;
namespace EditDistance
{
public class Program
{
const int SUBSTITUTION_COST = 1;
const int INSERTION_COST = 2;
const int DELETION_COST = 2;
@VegaFromLyra
VegaFromLyra / LCS
Created June 28, 2015 22:20
Longest common subsequence
using System;
using System.Text;
namespace LongestCommonSubsequence
{
public class Program
{
public static void Main(string[] args)
{
string s1 = "abc";
@VegaFromLyra
VegaFromLyra / wildCard
Created June 30, 2015 22:01
Wild card matching
using System;
// Given two strings where first string may contain wild card characters and second string
// is a normal string. Write a function that returns true if the two strings match.
// The following are allowed wild card characters in first string
// * --> Matches with 0 or more instances of any character or set of characters.
// ? --> Matches with any one character.
namespace WildCard
{
using System;
// Implement pow(x, n)
namespace Math.Power
{
public class Program
{
public static void Main(string[] args)
{
@VegaFromLyra
VegaFromLyra / Palindrome
Created July 1, 2015 15:40
Palindrome checker
using System;
using System.IO;
using System.Text;
namespace PalindromeChecker
{
public class Program
{
public static void Main(string[] args)
{