LeetCode – Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. - push(x) -- Push element x onto stack. - pop() -- Removes…
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. - push(x) -- Push element x onto stack. - pop() -- Removes…
Given a positive integer _n_, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to _n_. Example 1: Input: _n_ = Output…
You have a lock in front of you with circular wheels. Each wheel has slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and…
Given a linked list, rotate the list to the right by _k_ places, where _k_ is non-negative. Example 1: Example 2: Input: 0->1->2->NULL, k = Output: 2->0->1->…
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null
You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a separate…
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes