LinkedLists.Reverse
Пантелеев Станиславoptimal solution
public ListNode Reverse(ListNode head){ var node = head; ListNode prev = null; while(node != null){ var next = node.next; node.next = prev;
LinkedLists.FakeNode
Пантелеев СтаниславTo avoid border cases we can create a fake or how it is called sentinel node
public void DoSmth(ListNode head) { ListNode fakeNode = new
LinkedLists.DeleteNode
Пантелеев Станиславbasic approach is to change connection node.next = node.next.next
1. RemoveElements(ListNode head, int val)
leetcode task
optimal solution through sentinel or fake node
C#. Making Func delegates async
Пантелеев Станиславex.1
static void Main(string[] args) { SmthAsync(); for (int i = 0; i < 4; i++) { Thread.Sleep(1000); Console.WriteLine(i); } } private static Func<int,
C#.Task.SimpleExamples
Пантелеев СтаниславTasks executed in thread pool asyncroniously.
ex. 1 Returning no result
static void Main(string[] args) { Task t = new Task(() => Console.WriteLine(«this is
Algo.LinkedLists.DeleteNode
Пантелеев Станиславway 1, with sentinent or nullNode approach, shrinks partial cases
/** * Definition for singly-linked list. * public class ListNode { * public int val;
JS. Jest. TestFramework. SimpleExample
Пантелеев Станиславnpm init npm install —save-dev jest // add.js const add = (a, b) => a + b; module.exports = add; // test.js const add =
Js.myPromiseRace
Пантелеев Станиславconst myPromiseRace = (promises) => { return new Promise((resolve) => { for(let i = 0; i < promises.length; i++){ promises[i].then((value) => { resolve(value); // if
C#. Async / Await. Simple example
Пантелеев СтаниславThis is a simple example, we don’t wait for DoSmthAsync() in our calling main thread, just going further, when it is done, using its result