Shubham's corner
Software, AI, Optimisation, Learnings, Cooking and Traveling.
I use this space to share my learnings, experiments, technical and non-technical desicisions and everything else going with my life.

Shubham Kumar- 20 Jul, 2026
Just started neetcode blind 150
Just started Neetcode blind 150. This time I'm using java as my tool. Navigating through same challenges and learning more. To be honest, coding on job and coding on coding platform are very different. On job, you use HashMaps and you are mostly done. And there are exceptions when you use DP or Trees. My case, I think I have used mostly all the general data structures and some advanced ones too. But anyways, back to coding and building hand memory again.

Shubham Kumar- 20 Jul, 2026
charAt vs toCharArray
String as you know is immutable in java. When you try to manipulate a String object, Java creates a new String out of it. And object creation is expensive. There is a general rule, when you just want to read a character at any index use charAt and when you need to modify the string itself, like rearranging, sorting, creating sub string, breaking it into an array of characters using toCharArray is very cost efficient. toCharArray takes O(n) time for construction of array and O(n) space is also occupied.

Shubham Kumar- 20 Jul, 2026
Coffee addiction
I was feeling very sleepy since morning. Even after shower, breakfast and drinking salted lemon water the feeling of eyes dropping mid meet was not going anywhere. At 2 o'clock I got my lunch and coffee from Bistro. I generally have my coffee prepared from my French press. But not today, I wanted something new on my taste buds. And it's iced Americano. Just a sip and all my sleepiness went away and my eyes were opened like a bright sky is calling my name. I now know, I am addicted to Coffee.

Shubham Kumar- 19 Jul, 2026
Omelette Recipie
2 eggs + 10 ml Milk + Black pepper + Salt Mix them well then heat the pan for 2 minsPut the mixture in the pan and cove the lid for 2 minsUncover the lid and cook uncovered till the mixture is cooked enough
Shubham Kumar- 02 Mar, 2025
Working on mulitple braches at once using git worktree
Working on multiple branches at once Git worktree enables you to have multiple working directories linked to the same repository. Each directory can have its own branch checked out. And you can edit the code for each feature without changing or stashing the changes you did on each branch. Worktree creation The following command will create a new directory, debug with branch1 checked out. You can browse the ../debug directory and change the code as per your development for branch1. git worktree add ../debug branch1pwd echo somenewfeature on branch 1 > somenewfeature cat somenewfeature/home/cold/Projects/Personal/gitworktreedemo/debug somenewfeature on branch 1In the meanwhile you can keep editing the root directory with the main branch. pwd echo somenewfeature on main 1 > somenewfeatureonmain cat somenewfeatureonmain/home/cold/Projects/Personal/gitworktreedemo/main somenewfeature on main 1You can run the git commands going inside each directory. pwd git add . git status/home/cold/Projects/Personal/gitworktreedemo/main On branch main Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: somenewfeatureonmainpwd git add . git status/home/cold/Projects/Personal/gitworktreedemo/debug On branch branch1 Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: somenewfeatureList existing worktrees You can list your worktrees from the main as well as the debug directories. git worktree list/home/cold/Projects/Personal/gitworktreedemo/main e0ccbca [main] /home/cold/Projects/Personal/gitworktreedemo/debug 42ad28a [branch1]Remove a worktree When you are finally done with the feature branch, you can delete the worktree using remove command. git worktree remove ../debug ls .. git worktree listmain /home/cold/Projects/Personal/gitworktreedemo/main e0ccbca [main]Any commit you did on the feature branch will automatically be reflected in the main codebase. git checkout branch1 git log --onelineA somenewfeatureonmain 82cad2d done 42ad28a A commit on branch1 e0ccbca A commit on mainAdvice on working with worktreesAs the new directory will not be ignored by default, it is best to create your worktree directories out of git rootThe way I create my worktrees is I create a new directory with project name. Then I clone my actual repository inside this directory and keep my worktrees on the same level as project. For example, my main project is cloned inside main directory and I created debug directory in the same level as main. tree .. ├── debug │ └── somenewfeature └── main └── somenewfeatureonmain2 directories, 2 files