Skip to content

Instantly share code, notes, and snippets.

View vinaykr8807's full-sized avatar

Vinay Kumar vinaykr8807

View GitHub Profile
A = 1, 3
B = 2, 4
C =
min(min(A), min(B)) = 1
A = 3
B = 2, 4
C = 1
min(min(A), min(B)) = 2
@vinaykr8807
vinaykr8807 / snippet_0.py
Created February 25, 2026 04:07
sort list
class Solution(object):
def sortList(self, head):
if not head or not head.next:
return head
fast, slow = head.next, head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
start = slow.next
slow.next = None
@vinaykr8807
vinaykr8807 / optimize.py
Created February 24, 2026 20:13
Optimize result
from typing import List
class Solution:
def sortArrayByParityII(self, nums: List[int]) -> List[int]:
res = [0] * len(nums)
even, odd = 0, 1
for x in nums:
if x & 1:
res[odd] = x
@vinaykr8807
vinaykr8807 / snippet_0.py
Created February 24, 2026 20:13
sort list
class Solution(object):
def sortList(self, head):
if not head or not head.next:
return head
fast, slow = head.next, head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
start = slow.next
slow.next = None
@vinaykr8807
vinaykr8807 / snippet_0.py
Created February 24, 2026 18:09
sort list
class Solution(object):
def sortList(self, head):
if not head or not head.next:
return head
fast, slow = head.next, head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
start = slow.next
slow.next = None
@vinaykr8807
vinaykr8807 / verify.txt
Created February 23, 2026 06:08
Verify Gist Access
verification test