Leetcode category

Readmore

909. Snakes and Ladders

Problem description:

On an N x N board, the numbers from 1 to N*N are written boustrophedonically starting from the bottom left of the board, and alternating direction each row. For example, for a 6 x 6 board, the numbers are written as follows:

Readmore

Interview review

Thread vs Process

  • Definition
    A process is an instance of a computer program that is being executed. It contains the program code and its current activity. A process may be made up of multiple threads of execution that execute instructions concurrently. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.

Readmore

547. Friend Circles

Problem description:

There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, then A is an indirect friend of C. And we defined a friend circle is a group of students who are direct or indirect friends.

Readmore

279. Perfect Squares

Problem description:

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.

Readmore

53. Maximum Subarray

Problem description:

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

Readmore

918. Maximum Sum Circular Subarray

Problem description:

Given a circular array C of integers represented by A, find the maximum possible sum of a non-empty subarray of C.

Readmore

716. Max Stack

Problem description:

Design a max stack that supports push, pop, top, peekMax and popMax.

Readmore

155. Min Stack

Problem description:

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

Readmore

703. Kth Largest Element in a Stream

Problem description:

Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.

Readmore