Tag: leetcode
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) : …
Simplify an absolute path for a file (Unix-style): For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" Did you consider the case where path = “/../”? …
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, …
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that …