---
title: "Utkarsh Shrivastava (@utkarshinobi) | Hashnode"
description: "Algorithms, AI Engineering, Full Stack Systems. Read the latest articles by Utkarsh Shrivastava on Hashnode."
url: "https://hashnode.com/@utkarshinobi"
---

@utkarshinobi

# Utkarsh Shrivastava

@utkarshinobi · San Francisco, USA · Joined October 2026

Algorithms, AI Engineering, Full Stack Systems

### [Union find in Python](https://basecase-utkarsh.hashnode.dev/union-find-in-python?utm_source=hashnode&utm_medium=feed)

Are a and b already connected? If you're adding undirected edges one at a time, union find answers that by comparing two roots. 1. Follow the parents Each node starts in its own group with parent\[x\] =

2 min read · [basecase-utkarsh.hashnode.dev](https://basecase-utkarsh.hashnode.dev/union-find-in-python?utm_source=hashnode&utm_medium=feed)

[Nov 22](https://hashnode.com/posts/union-find-in-python/6b025ada4b3f4dc3cee485de)

### [Building a tree from preorder + inorder](https://basecase-utkarsh.hashnode.dev/building-a-tree-from-preorder-inorder?utm_source=hashnode&utm_medium=feed)

Preorder tells you which node is the root. Inorder tells you which nodes go to its left and which go to its right. Take one root at a time, split the arrays, and recurse. With a hashmap and a pointer

6 min read · [basecase-utkarsh.hashnode.dev](https://basecase-utkarsh.hashnode.dev/building-a-tree-from-preorder-inorder?utm_source=hashnode&utm_medium=feed)

[Nov 22](https://hashnode.com/posts/building-a-tree-from-preorder-inorder/6b0258f9bf1b7b2940db90ec)

### [Sliding window without the guesswork](https://basecase-utkarsh.hashnode.dev/sliding-window-without-the-guesswork?utm_source=hashnode&utm_medium=feed)

Sliding window turns "check every subarray" (O(n²)) into one pass (O(n)). Grow the window on the right, shrink it on the left, and keep state you can update in O(1). 1. Spot it Use a sliding window wh

3 min read · [basecase-utkarsh.hashnode.dev](https://basecase-utkarsh.hashnode.dev/sliding-window-without-the-guesswork?utm_source=hashnode&utm_medium=feed)

[Oct 18](https://hashnode.com/posts/sliding-window-without-the-guesswork/6ad559466f3c3a1504546a9e)

### [Binary search without the off-by-one guesswork](https://basecase-utkarsh.hashnode.dev/binary-search-without-the-off-by-one-guesswork?utm_source=hashnode&utm_medium=feed)

Binary search is easy to explain and easy to get wrong. left <= right or left < right? mid or mid + 1? Return left or right? Here's my first attempt at LeetCode 981: Time Based Key-Value Store, which

3 min read · [basecase-utkarsh.hashnode.dev](https://basecase-utkarsh.hashnode.dev/binary-search-without-the-off-by-one-guesswork?utm_source=hashnode&utm_medium=feed)

[Oct 11](https://hashnode.com/posts/binary-search-without-the-off-by-one-guesswork/6acaf8db8da29a052167e620)
