![]() |
Solve it!!! Intresting One!!!
Can you Anyone solve this problem...
There is given one array lets say Arr[n]( n is the size of array). You have to store multiplication of all elements of Arr[n] except element Arr[i] into a array OutVar[i]. Example: Code:
Suppose given am array asminimize space also) 2. Division(/) or Modular division(%) are not allowed. |
Re: Solve it!!! Intresting One!!!
The code would be something like this I suppose:
Code:
int main() |
Re: Solve it!!! Intresting One!!!
The code would be something like this I suppose:
Code:
int main() |
Re: Solve it!!! Intresting One!!!
the result int avariable must be set to 1 since the beginning
|
Re: Solve it!!! Intresting One!!!
also supposing the two array sizes are equal. n=n2
|
Re: Solve it!!! Intresting One!!!
Quote:
Nice Appreciated!!! But dear One thing Time complexity of your program is O(n2 *n) ~=O(sqr(n)) But you have to solve it in time O(n) i.e. Linear. |
Re: Solve it!!! Intresting One!!!
Can this be the solution?
Code:
void main() |
Re: Solve it!!! Intresting One!!!
Soorry, 'i' is wrong it will be 'cnt' everywhere in the previous one.
|
Re: Solve it!!! Intresting One!!!
When using code block try indenting your code so that its easy to read for others.
|
Re: Solve it!!! Intresting One!!!
Quote:
|
| All times are GMT +5.5. The time now is 07:43. |