my image

Dmitrii Volyx

I’m Dmitrii, a Senior Software Engineer at Meta working on Wearables Performance.
I write about software engineering, performance, and open-source.

Backspace String Compare

Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. 1 2 3 4 5 Example 1: Input: S = "ab#c", T = "ad#c" Output: true Explanation: Both S and T become "ac". 1 2 3 4 5 Example 2: Input: S = "ab##", T = "c#d#" Output: true Explanation: Both S and T become "". 1 2 3 4 5 Example 3: Input: S = "a##c", T = "#a#c" Output: true Explanation: Both S and T become "c". 1 2 3 4 5 Example 4: Input: S = "a#c", T = "b" Output: false Explanation: S becomes "c" while T becomes "b". Note: ...

April 13, 2020 · 2 min · volyx

Middle of the Linked List

Middle of the Linked List

April 12, 2020 · 2 min · volyx

Middle of the Linked List

Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. 1 2 3 4 5 6 7 Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3. (The judge's serialization of this node is [3,4,5]). Note that we returned a ListNode object ans, such that: ans.val = 3, ans.next.val = 4, ans.next.next.val = 5, and ans.next.next.next = NULL. 1 2 3 4 5 Example 2: Input: [1,2,3,4,5,6] Output: Node 4 from this list (Serialization: [4,5,6]) Since the list has two middle nodes with values 3 and 4, we return the second one. Note: ...

April 12, 2020 · 2 min · volyx

Archive

archives

0 min · volyx