Boolean Algebra and introduction with examples. A key concept to determine logic in computer programming as well as mathematical problems.
nikoo28
nikoo28
a tech-savvy guy and a design buff... I was born with the love for exploring and want to do my best to give back to the community. I also love taking photos with my phone to capture moments in my life. It's my pleasure to have you here.
-
-
Given an array of positive integers with some zeroes. You need to move all the zeroes to the end without changing the relative order of non-zero elements. A unique solution makes this problem really easy to understand.
-
Binary Search is a fabulous concept that can be used to narrow down the search range. One such problem on LeetCode explores this domain where you need to find the correct position to insert the element in a sorted array
-
Small problems like these often become a part of larger complex problems. You are given an array and for each integer you need to find out the number of smaller numbers than itself. One technique is to compare each element with every other element. Another efficient approach would be to use the counting sort approach.
-
Always make sure that we understand the problem statement first. There is an array of integers nums and we need to determine the number of good pairs. A pair (i , j ) is said to be good, if nums[i] == nums[j] and i < j. We need to determine how many pairs can we form that hold this condition. Let us look at some sample test cases: Input: nums = [ 1 , 2 , 3 , 1 , 1 , 3 ]Output: 4Explanation:There are 4 good pairs. (0…
-
Given a sorted array and a target element, find its first and last index.
-
A camel case is a special string representation in which the first word starts with a small letter, and all other words start with an upper case character. Given such a string, find the total number of words
-
Let us try to understand this problem statement first. We have some strings that needs to be super reduced in size. The string consists of english alphabets from a to z, and they can be duplicated at some places. If we see two adjacent characters that are same, they can be eliminated. Following this pattern we have to return a super compressed/reduced string. Let us look at some sample test cases: Input: aabcccddOutput: “bc”Explanation:aabcccdd -> bcccdd -> bcdd -> bc(we eliminate two same adjacent characters at each step) Input: abbaOutput:…
-
Let us try to understand this problem statement first. We are in charge of a fancy circus and 2 kangaroos have to jump on a number line. The interesting part is that both the kangaroos have a different start position, and different jump distances. It is a little tricky to understand, the problems asks to calculate the number line jumps such that both the kangaroos are at the same position. We will try to simplify this using some diagrams, and see how the kangaroos actually jump. In the given test…
-
Delete a node from a linked list at 3 places. Beginning, end and somewhere in the middle. It is all about updating the pointers.