ZENVEC - Editorial

PROBLEM LINK

Practice

Author: Mann Mehta
Tester: Vatsal Parmar
Editorialist: Jaymeet Mehta

DIFFICULTY

Cakewalk

PREREQUISITES:

Basic Math

PROBLEM

You are give two integer S and D denoting source and destination of Zeno's journey, his vehicle travel every half of the remaining distance and take rest for 2 Minutes. Your task is to find time taken to reach the destination if possible.

QUICK EXPLANATION

The only main point was to find out that he will never be able to reach his destination.

EXPLANATION

As it is given that his vehicle travels half of the distance and takes rest. Every time he always travels half of the distance. So even if he is left with a distance of 1 he will travel half i.e. 0.5 , then again half i.e. 0.25. So it will never be exactly 0, i.e. equal to D. so unless the distance given between source and destination is 0, he will never reach his destination.

This question is based Zeno's Dichotomy Paradox

TIME COMPLEXITY

Time Complexity is O(1) per test case.

SOLUTIONS

Author’s Solution

Tester’s Solution

Editorialist’s Solution

1 Like