## nikhils.codecracker

BAN USER- 0of 0 votes

AnswersA number series have numbers in the increasing order where numbers are of the form 2^m*3^n*5^p. where m,n,p are an non negative integers. The initial few number of the series are

- nikhils.codecracker in India for Retail

1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18......

Write a function to get the nth term of such a sequence.| Report Duplicate | Flag | PURGE

Flipkart SDE-2 Math & Computation

Let two list be L1 and L2. Count the number of nodes in list L1, lets say its c1. Then reverse list L2( you can do it using three pointers). Again count number of nodes in L1, lets says count now is c2.

if(c1 == c2)

Lists do not merge

else

(c1 - c2) common nodes between L1 and L2.

All the operations are O(N) so overall time complexity is O(N).

In the expression f(n) = f(n-1) + f(n-2) + f(n-3) + f(n-4), how do we make sure that there are no overlapping sets between f(n-1) branch and f(n-2) branch and other branches. I think we will have overlapping sets. Just consider this scenario

In f(n-1), we have already selected a disk of height 1, now we select one disk of height 2 and all the remaining disks of height 1. We will effectively have one disk of height 2 and n-2 disks of height 1.

And in f(n-2), we have already selected a disk of height 2, and for remaining n-2 height we can select n-2 disks of height 1, so again we will end up with one disk of height 2 and n-2 disks of height 1.

Rep**sandrafdenn**, Associate at CareerCupJe suis développeur web dans une société de Wild Oats Markets, j'adore faire du shopping et j'ai une ...

Rep**deloresrdaniels**, Cloud Support Associate at JDACrossed the country marketing wool in Nigeria. Was quite successful How to Get Girlfriend Back By Vashikaran Mantra . Spent a ...

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Let two list be L1 and L2. Count the number of nodes in list L1, lets say its c1. Then reverse list L2( you can do it using three pointers). Again count number of nodes in L1, lets says count now is c2.

- nikhils.codecracker January 25, 2015if(c1 == c2)

Lists do not merge

else

(c1 - c2) common nodes between L1 and L2.

All the operations are O(N) so overall time complexity is O(N).