May 31, 2020

#LeetCode: Edit Distance

Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.

You have the following 3 operations permitted on a word:
  • Insert a character
  • Delete a character
  • Replace a character

May 30, 2020

Vindu Dara Singh urges fans to tune in to Star Plus to watch his late father

Vindu Dara Singh shares Hanuman’s entry promo from Ramayan as he remembers his father Dara Singh.

Ramayan – the historical mythological show that reached the audiences through television in the yesteryears has made a come-back to re-entertain its audiences on Star Plus, India’s leading Hindi GEC’s.

#LeetCode: K Closest Points to Origin

We have a list of points on the plane.  Find the K closest points to the origin (0, 0).(Here, the distance between two points on a plane is the Euclidean distance.)

You may return the answer in any order.  The answer is guaranteed to be unique (except for the order that it is in.)

May 29, 2020

Taniya Chatterjee roped in for Ullu App's 'Kasak'

Ullu App is coming up with a web-series 'Kasak', which is based on a life of a rape victim. After roping in Hate Story' actress Ihana Dhillon, Minissha Lamba, Vineet Raina the makers have now finalized Gandii Baat 4 fame Taniya Chatterjee.

#LeetCode: Course Schedule

There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1.

Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]

Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all courses?

Example 1:
Input: numCourses = 2, prerequisites = [[1,0]]
Output: true
Explanation: There are a total of 2 courses to take.
             To take course 1 you should have finished course 0. So it is possible.

Example 2:
Input: numCourses = 2, prerequisites = [[1,0],[0,1]]
Output: false
Explanation: There are a total of 2 courses to take.
             To take course 1 you should have finished course 0, and to take course 0 you should
             also have finished course 1. So it is impossible.

Constraints:
The input prerequisites is a graph represented by a list of edges, not adjacency matrices. Read more about how a graph is represented.
You may assume that there are no duplicate edges in the input prerequisites.
1 <= numCourses <= 10^5

GIT URL: Java Solution of Leet Code's Course Schedule problem
Java Solution 1



-K Himaanshu Shuklaa.

May 28, 2020

#LeetCode: Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.

Example 1:
Input: 2
Output: [0,1,1]

Example 2:
Input: 5
Output: [0,1,1,2,1,2]

May 27, 2020

#LeetCode: Possible Bipartition

Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size.

Each person may dislike some other people, and they should not go into the same group.

Formally, if dislikes[i] = [a, b], it means it is not allowed to put the people numbered a and b into the same group.

Return true if and only if it is possible to split everyone into two groups in this way.

May 26, 2020

#LeetCode: Contiguous Array

Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.

Example 1: Input: [0,1], Output: 2
Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.

Example 2: Input: [0,1,0], Output: 2
Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1.

Note: The length of the given binary array will not exceed 50,000.

Crime Patrol actress Preksha Mehta commits suicide

Preksha Mehta, who did a couple of episodic's of Crime Patrol committed suicide.


May 25, 2020

#LeetCode: Uncrossed Lines

We write the integers of A and B (in the order they are given) on two separate horizontal lines.

Now, we may draw connecting lines: a straight line connecting two numbers A[i] and B[j] such that:
A[i] == B[j];
The line we draw does not intersect any other connecting (non-horizontal) line.
Note that a connecting lines cannot intersect even at the endpoints: each number can only belong to one connecting line.

Return the maximum number of connecting lines we can draw in this way.

May 24, 2020

#LeetCode: Construct Binary Search Tree from Preorder Traversal

Return the root node of a binary search tree that matches the given preorder traversal.

(Recall that a binary search tree is a binary tree where for every node, any descendant of node.left has a value < node.val, and any descendant of node.right has a value > node.val.  Also recall that a preorder traversal displays the value of the node first, then traverses node.left, then traverses node.right.)

It's guaranteed that for the given test cases there is always possible to find a binary search tree with the given requirements.

May 23, 2020

#LeetCode: Interval List Intersections

Given two lists of closed intervals, each list of intervals is pairwise disjoint and in sorted order.

Return the intersection of these two interval lists.

(Formally, a closed interval [a, b] (with a <= b) denotes the set of real numbers x with a <= x <= b.  The intersection of two closed intervals is a set of real numbers that is either empty, or can be represented as a closed interval.  For example, the intersection of [1, 3] and [2, 4] is [2, 3].)

May 22, 2020

After Gulabo Sitabo & Shakuntala Devi, 'Indoo Ki Jawaani' to be released online?

After Amitabh Bachchan and Ayushmann Khurrana starrer 'Gulabo Sitabo' and Vidya Balan's much awaited 'Shakuntala Devi', Kiara Advani's next 'Indoo Ki Jawaani' might be released online.

As per the latest buzz, "'Indoo Ki Jawaani' is ready and the post-production work will be completed soon. It was suppose to release worldwide on June 5th, 2020, however, due to pandemic release has been postponed. Now, Nikkhil Advani and Monisha Advani, from Emmay Entertainment want to release it on the web. They are already in talks with several OTT platforms, however nothing is finalized as of now."

#LeetCode: Sort Characters By Frequency

Given a string, sort it in decreasing order based on the frequency of characters.

Example 1:
Input: "tree"
Output: "eert"
Explanation:
'e' appears twice while 'r' and 't' both appear once.
So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer.

May 21, 2020

#LeetCode: Count Square Submatrices with All Ones

Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.

Example 1:
Input: matrix =
[
  [0,1,1,1],
  [1,1,1,1],
  [0,1,1,1]
]
Output: 15
Explanation:
There are 10 squares of side 1.
There are 4 squares of side 2.
There is  1 square of side 3.
Total number of squares = 10 + 4 + 1 = 15.

May 20, 2020

Anushka Sharma immensely misses celebrity hair maestro Aalim Hakim!

Hands down, Aalim Hakim is definitely the captain when it comes to styling the who's who of Bollywood and known personalities across India including cricketer Virat Kohli.