Tag: algorithm
You are asked to remove all elements of value val from a integer linked list. For example, Remove 2 from the following list, 1 -> 2 -> 2 -> …
There is a 2D binary matrix M filled with 0’s and 1’s, your task is to find the largest square containing all 1’s and return its area. For example, …
Question: How to determine if a linked list has a cycle? The Singly Linked List is defined as follows: struct ListNode { int val; ListNode *next; ListNode(int x) : …
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, …
Remove the nth node from the end of a singly linked list and return its head. For example, input: 1-2-3-4-5, and n = 2. Removing the second node from …