Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each...
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of ...
Given a string s, find the length of the longest substring without repeating characters.
Given a 32-bit signed integer, reverse digits of an integer.Note:Assume we are dealing with an environment that could only store integers within the 3
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font
Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Follow up: Could you solve it with
Given n non-negative integers $a1, a2, ..., an$ , where each represents a point at coordinate (i, $ai$). n vertical lines are drawn such that
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.For example, 2 is written as II in Roman numeral, just two one's add
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.For example, 2 is written as II in Roman numeral, just two one's add
Given a string s containing just the characters '(', ')', '{', '}', '\[' and ']', determine if the input string is valid.An input string is valid if:O
Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists.Ex
Given the head of a linked list, remove the $n^{th}$ node from the end of the list and return its head.Follow up : Could you do this in one pass?Examp
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length.Do not allocate extra sp
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Clarification:What should w
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 data structure that follows the constraints of a Least Recently Used (LRU) cache.Implement the LRUCache class:LRUCache(int capacity) Initiali
Implement a last in first out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal queue (`push`, ..
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it w...