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
class Program | |
{ | |
static readonly Dictionary<string, long> memoized = new Dictionary<string, long>(); | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(CountDecode("111")); | |
} | |
private static long CountDecode(string s) | |
{ |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Node node = new Node("root", new Node("left", new Node("left.left"), null), new Node("right")); | |
string serializedNode = node.Serialize(); | |
var deserializedNode = Node.Deserialize(serializedNode); | |
if (deserializedNode.Left.Left.Val != "left.left") | |
{ | |
throw new Exception("incorrect!"); |
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
private static long[] ProductArray(int[] inputArray) | |
{ | |
int n = inputArray.Length; | |
long[] outputArray = new long[n]; | |
long[] leftToRight = new long[n]; | |
long[] rightToLeft = new long[n]; | |
// product left to right | |
leftToRight[0] = inputArray[0]; | |
for (int i = 1; i < n; i++) |
NewerOlder