Blogs Hub

by AskGif | Sep 28, 2020 | Category :coding

Longest Harmonious Subsequence - Hash Table - Easy - LeetCode

Longest Harmonious Subsequence - Hash Table - Easy - LeetCode

We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences. A subsequence of array is a sequence

read more...

by AskGif | Sep 28, 2020 | Category :coding

Distribute Candies - Hash Table - Easy - LeetCode

Distribute Candies - Hash Table - Easy - LeetCode

You have n candies, the ith candy is of type candies[i]. You want to distribute the candies equally between a sister and a brother so that each of them gets n / 2 candies (n is even). The sister loves to collect different types of candies, so you want to give her the maximum number of diff

read more...

by AskGif | Sep 28, 2020 | Category :coding

Keyboard Row - Hash Table - Easy - LeetCode

Keyboard Row - Hash Table - Easy - LeetCode

Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Example: Input: ["Hello", "Alaska", "Dad", "Peace"]<br />Output: ["Alaska", "Dad"]<br />&nbsp; Note: You may use one charact

read more...

by AskGif | Sep 28, 2020 | Category :coding

Island Perimeter - Hash Table - Easy - LeetCode

Island Perimeter - Hash Table - Easy - LeetCode

ou are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connect

read more...

by AskGif | Sep 28, 2020 | Category :coding

Number of Boomerangs - Hash Table - Easy - LeetCode

Number of Boomerangs - Hash Table - Easy - LeetCode

Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters). Find the number of boomerangs. You may assume that n will be at most 500 and

read more...

by AskGif | Sep 28, 2020 | Category :समाचार

We Don’t Even Smoke Cigarettes, Said Deepika, Sara, Rakul & Shraddha: NCB Official

हम स्मोक सिगरेट, दीपिका, सारा, रकुल को याद नहीं करते

एनबीए के एक अधिकारी ने खुलासा किया है कि बॉलीवुड की सभी चार अभिनेत्रियों, दीपिका पादुकोण, सारा अली खान, रकुल सिंह और श्रद्धा कपूर, जिनसे हाल ही में नारकोटिक्स कंट्रोल ब्यूरो (एनसीबी) ने पूछताछ की थी, ने मादक द्रव्यों के सेवन से इनकार किया है। उन्होंने कहा कि वे अपने व्हाट्सएप संदेशों में हाथ से ल

read more...

by AskGif | Sep 28, 2020 | Category :coding

Longest Palindrome - Hash Table - Easy - LeetCode

Longest Palindrome - Hash Table - Easy - LeetCode

Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, "Aa" is not considered a palindrome here. &nbsp; Example 1: Input: s = "abccccd

read more...

by AskGif | Sep 28, 2020 | Category :coding

Find the Difference - Hash Table - Easy - LeetCode

Find the Difference - Hash Table - Easy - LeetCode

Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the letter that was added in t. Example: Input:<br />s = "abcd"<br />t = "abcde" Output:

read more...

by AskGif | Sep 28, 2020 | Category :coding

Intersection of Two Arrays II - Hash Table - Easy - LeetCode

Intersection of Two Arrays II - Hash Table - Easy - LeetCode

Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2]<br />Output: [2,2]<br />Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]<br />Output: [4,9]<br />Note: Each element in the result should appear as

read more...

by AskGif | Sep 28, 2020 | Category :coding

Word Pattern - Hash Table - Easy - LeetCode

Word Pattern - Hash Table - Easy - LeetCode

Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. &nbsp; Example 1: Input: pattern = "abba", s = "dog cat cat dog"<br />Output: true<

read more...

by AskGif | Sep 28, 2020 | Category :coding

Valid Anagram - Hash Table - Easy - LeetCode

Valid Anagram - Hash Table - Easy - LeetCode

Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram"<br />Output: true<br />Example 2: Input: s = "rat", t = "car"<br />Output: false<br />Note:<br />You may assume the string contains only lowercase

read more...

by AskGif | Sep 27, 2020 | Category :coding

Isomorphic Strings - Hash Table - Easy - LeetCode

Isomorphic Strings - Hash Table - Easy - LeetCode

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the

read more...