All Posts

Leetcode 136: Single Number

Given a non-empty array of integers where every element appears twice except for one element that appears once, find the single element that appears only once. The solution must have linear time complexity and use only constant space.

Leetcode 141: Linked List Cycle

Given the head of a linked list, determine if there is a cycle. A cycle occurs if a node can be revisited by following the ’next’ pointers. The ‘pos’ parameter denotes where the last node connects to. If ‘pos’ is -1, there is no cycle.

Leetcode 144: Binary Tree Preorder Traversal

You are given the root of a binary tree. The task is to return the preorder traversal of the tree. Preorder traversal means visiting the root node first, followed by the left subtree, and then the right subtree.

Leetcode 168: Excel Sheet Column Title

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

Leetcode 169: Majority Element

Given an array nums of size n, return the majority element. The majority element is the element that appears more than n // 2 times. You may assume that the majority element always exists in the array.

Leetcode 190: Reverse Bits

Given a 32-bit unsigned integer, reverse its bits and return the result as an unsigned integer.