Fundamental concepts, best practices and 'etudes'
def two_sum_sorted(arr: List[int], target: int) -> List[int]:
left = 0
right = len(arr) - 1
while left < right:
sum = arr[left] + arr[right]
if sum == target:
return left, right
if sum < target:
left += 1
else:
right -= 1
def binary_search(arr, target):
left = 0
right = len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
if arr[mid] < target:
left += 1
else:
right -= 1
return -1
def binary_search(arr, target):
left, right = 0, len(arr) - 1
first_true_index = -1
while left <= right:
mid = (left + right) // 2
if feasible(mid):
first_true_index = mid
right = mid - 1
else:
left = mid + 1
return first_true_index
Techniques for optimizing React applications
When to use useState, useReducer, or external state management
Understanding React component lifecycle and hooks
optional chaining, nullish coalescing, and non-null assertion operators
Combining public keyword parameter properties with the Result Pattern for clean error handling in APIs
Best practices for handling asynchronous operations
Modern JavaScript features every developer should know
Reading, writing, and managing files in Node.js applications
Building APIs and web servers with Node.js fundamentals