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
[FunctionName(nameof(SomeCommandFunction))] | |
public static async Task<Guid> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post")] | |
HttpRequestData req, FunctionExecutionContext executionContext, | |
ILogger logger, | |
IUnitOfWork unitOfWork) | |
{ | |
logger.LogInformation("Function started"); | |
// some Logic (skipped for simplicity) | |
var addedId = Guid.NewGuid(); |
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
static void Main(string[] args) | |
{ | |
int n = 5, m = 5; | |
Console.WriteLine(CountPaths(n, m)); // 70 | |
} | |
static int CountPaths(int n, int m) | |
{ | |
int[,] dp = new int[n, m]; | |
dp[n - 1, m - 1] = 1; |
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) | |
{ | |
int[] a = new int[] { 15, 5, 20, 10, 35, 15, 10 }; | |
Console.WriteLine(Partition(a, a.Sum() / 2)); // true | |
} | |
private static bool Partition(int[] a, int 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 int[] s; | |
static int k; | |
static Point[,] points; | |
static void Main(string[] args) | |
{ | |
k = 24; | |
s = new int[] { 12, 1, 61, 5, 9, 2 }; |
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) | |
{ | |
int k = 24; | |
int[] s = new int[] { 12, 1, 61, 5, 9, 2 }; | |
s = s.Where(x => x <= k).ToArray(); | |
int n = s.Length; | |
List<int> indices = new List<int>(); |
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) | |
{ | |
Console.WriteLine(PatternMatching("cheat", "c.*t")); // true | |
Console.WriteLine(PatternMatching("bcd", "abcd")); // false | |
Console.WriteLine(PatternMatching("cheat", "c.*te")); // false | |
Console.WriteLine(PatternMatching("abcdef", ".***************************.")); // true | |
Console.WriteLine(PatternMatching("abcdef", ".***************************")); // true | |
} |
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) | |
{ | |
bool[][] matrix = new bool[][] | |
{ | |
new bool[] {false, false, false, false }, | |
new bool[] {true, true, false, true }, | |
new bool[] {false, false, false, false }, | |
new bool[] {false, false, false, false }, |
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) | |
{ | |
Tuple<long, double> tuple = CalculatePI(new Random(0)); | |
var points = tuple.Item1; | |
var pi = tuple.Item2; | |
Console.WriteLine($"PI: {pi} using Monte Carlo method with {points} points."); | |
} |
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) | |
{ | |
Console.WriteLine(LongestSubstringWithKUniqueChars("abcba", 2)); | |
} | |
private static string LongestSubstringWithKUniqueChars(string s, int k) | |
{ | |
if (k == 0) |
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) | |
{ | |
Trie trie = new Trie(); | |
trie.Insert("dog"); | |
trie.Insert("deer"); | |
trie.Insert("deal"); | |
var foundWords = trie.Search("de"); |
NewerOlder