July 18, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Palindrome Number /** * 9. Palindrome Number * <p> * Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. * <p> * Example 1: * <p> * Input: 121 * Output: true * Example 2: * <p> * Input: -121 * Ou...
Read moreJuly 17, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Middle of the Linked List /** * 876. Middle of the Linked List * <p> * Given a non-empty, singly linked list with head node head, return a middle node of linked list. * <p> * If there are two middle nodes, return the second middle node. * <p> * Example 1: * <p> *...
Read moreJuly 16, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Longest Substring Without Repeating Characters /** * 3. Longest Substring Without Repeating Characters * <p> * Given a string, find the length of the longest substring without repeating characters. * <p> * Example 1: * <p> * Input: "abcabcbb" * Output: 3 * Explanation:...
Read moreJuly 15, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Detect loop in linked list /** * 141. Linked List Cycle * <p> * Given a linked list, determine if it has a cycle in it. * <p> * To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the * linked list where tail connect...
Read moreJuly 14, 2019 by Sandeep Bhardwaj | Tags: Leetcode Datastructure & Algorithms
Find the smallest missing positive integer /** * 41. First Missing Positive * <p> * Given an unsorted integer array, find the smallest missing positive integer. * <p> * Example 1: * <p> * Input: [1,2,0] * Output: 3 * Example 2: * <p> * Input: [3,4,-1,1] * Outp...
Read more