All Posts

Leetcode 191: Number of 1 Bits

Given a positive integer n, return the number of set bits (1s) in its binary representation, also known as the Hamming weight.

Leetcode 202: Happy Number

A happy number is a number that eventually reaches 1 when replaced by the sum of the squares of its digits. If the process results in an endless loop of numbers, the number is not happy. Your task is to determine whether a given number is a happy number.

Leetcode 205: Isomorphic Strings

Two strings s and t are isomorphic if you can replace the characters in s to get t. The replacement should be such that each character in s maps to exactly one character in t, and the mapping must preserve the order of characters. No two characters in s or t can map to the same character.

Leetcode 206: Reverse Linked List

Given the head of a singly linked list, reverse the list and return the new head of the reversed list. You need to reverse the order of the nodes in the list such that the first node becomes the last, the second becomes the second to last, and so on.

Leetcode 217: Contains Duplicate

Given an array of integers, determine if there are any duplicate values present. Return true if any value appears more than once, otherwise return false.

Leetcode 225: Implement Stack using Queues

Design a stack that supports LIFO (Last In First Out) operations using only one queue. Implement standard stack operations: push, pop, top, and empty.