A Mental Illness Disguised as Alopecia

The events of the latest televised Academy Awards have caused a clashing of the minds, people second-guessing violent tactics in the name of protecting family, and a certain awareness about alopecia…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Solving Array Coding Problems

Solving Array coding problems with explanation

Subarray with given sum

Given an unsorted array A of size N of non-negative integers, find a continuous sub-array that adds to a given number.

Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice.

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

Given an array A[] consisting of 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s and all 2s in last.

We count the number of 0’s, 1’s, and 2’s and then put them in the array in their correct order, time complexity is O(n) but it requires two traversals of the array.

2. Similar to 3-way partitioning for Dutch national flag problem

Given an array nums of n integers where n > 1, return an array outputsuch that output[i] is equal to the product of all the elements of nums except nums[i].

Add a comment

Related posts:

Your online privacy matters

Since the European Union’s rules on online privacy were last updated in 2009, there have been huge changes in how we communicate online. Messaging apps such as WhatsApp, Facebook Messenger or…

Do you trust this?

There have been a couple of prominent news stories that might give us all pause for thought over the weekend. Research suggests that children are more trusting of robots than they are of other…

After 7 years now on fiver

My name is Zain and I am from Pakistan. I started earing in 2012 when I was a student by doing SEO. I earned a lot at that time then I moved on Facebook pages and also earned too good till 2017. So I…