July 23, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Single Number /** * 136. Single Number * <p> * Given a non-empty array of integers, every element appears twice except for one. Find that single one. * <p> * Note: * <p> * Your algorithm should have a linear runtime complexity. Could you implement it without using extra ...
Read moreJuly 22, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Maximum Depth of Binary Tree /** * 104. Maximum Depth of Binary Tree * Given a binary tree, find its maximum depth. * <p> * The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. * <p> * Note: A leaf is a node with no ...
Read moreJuly 21, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Remove Duplicates from Sorted List /** * 83. Remove Duplicates from Sorted List * <p> * Given a sorted linked list, delete all duplicates such that each element appear only once. * <p> * Example 1: * <p> * Input: 1->1->2 * Output: 1->2 * Example 2: * <p>...
Read moreJuly 20, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Remove Duplicates from Sorted Array /** * 26. Remove Duplicates from Sorted Array * <p> * Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. * <p> * Do not allocate extra space for another array, you must ...
Read moreJuly 19, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Remove All Adjacent Duplicates In String /** * 1047. Remove All Adjacent Duplicates In String * <p> * Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. * <p> * We repeatedly make duplicate removals ...
Read more