Skip to content

Instantly share code, notes, and snippets.

View rtsoy's full-sized avatar
:octocat:

Roman rtsoy

:octocat:
  • Astana, Kazakhstan
View GitHub Profile
@rtsoy
rtsoy / search-in-rotated-sorted-array.go
Last active January 1, 2026 15:22
33. Search in Rotated Sorted Array
// https://leetcode.com/problems/search-in-rotated-sorted-array/
//
// Time: O(log n)
// Space: O(1)
//
// n = number of elements in the array
// .................... //
func search(nums []int, target int) int {
@rtsoy
rtsoy / search-a-2d-matrix.go
Created January 1, 2026 14:43
74. Search a 2D Matrix
// https://leetcode.com/problems/search-a-2d-matrix/
//
// Time: O(log(m*n))
// Space: O(1)
//
// m = number of rows
// n = number of columns
// .................... //
@rtsoy
rtsoy / reverse-linked-list.go
Created January 1, 2026 14:22
206. Reverse Linked List
// https://leetcode.com/problems/reverse-linked-list/
//
// Time: O(N)
// Space: O(1)
//
// N = number of nodes in the list
// .................... //
/**
@rtsoy
rtsoy / add-two-numbers.go
Created January 1, 2026 14:12
2. Add Two Numbers
// https://leetcode.com/problems/add-two-numbers/
//
// Time: O(N)
// Space: O(N)
//
// N = number of nodes in the longer list
// .................... //
/**
@rtsoy
rtsoy / merge-k-sorted-lists.go
Last active January 1, 2026 13:59
23. Merge k Sorted Lists
// https://leetcode.com/problems/merge-k-sorted-lists
//
// Time: O(N log k)
// Space: O(k)
//
// k = len(lists)
// N = total number of nodes across all lists
// .................... //