BSBlake Sweezyinlc.sweezy.io·Sep 15, 2024 · 2 min readWeekly Contest 415Q1: The Two Sneaky Numbers of Digitville In the town of Digitville, there was a list of numbers called nums containing integers from 0 to n - 1. Each number was supposed to appear exactly once in the list, however, two mischievous numbers sneaked in ...00
BSBlake Sweezyinlc.sweezy.io·Sep 11, 2024 · 1 min read191. Number of 1 BitsWrite a function that takes the binary representation of a positive integer and returns the number of set bits it has (also known as the Hamming weight). Thoughts This one is basically identical to 2220 kekw Solution class Solution { public int...00
BSBlake Sweezyinlc.sweezy.io·Sep 11, 2024 · 1 min read2220. Minimum Bit Flips to Convert NumberA bit flip of a number x is choosing a bit in the binary representation of x and flipping it from either 0 to 1 or 1 to 0. For example, for x = 7, the binary representation is 111 and we may choose any bit (including any leading zeros not shown) and...00
BSBlake Sweezyinlc.sweezy.io·Sep 7, 2024 · 1 min read104. Maximum Depth of Binary TreeGiven the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Thoughts As with a lot of tree algorithms I think the best solu...00
BSBlake Sweezyinlc.sweezy.io·Sep 7, 2024 · 2 min read226. Invert Binary TreeGiven the root of a binary tree, invert the tree, and return its root. Thoughts Seems like a pretty simple problem, I would imagine that doing this recursively would be the easiest way to go about it Simply swap the left and right nodes, then recur...00