A collection of 14 posts

Engineering

Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed.

An n-bit gray code sequence is a sequence of 2n integers where

Given two integers n and k, return all possible combinations of k numbers out of the range [1, n].

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).

Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.