Bhai ye O(1) extra space me bhi ban jayga just need to take the count lf zeros if zeros are more than 1 no matter what all values will be zero of zeros are 1 for sure that vak can be calculated and if no zeros in the array it's fine as well
Count the Zeroes , if more than 1 zeroes are there then entire ans array will be Zero , but if only 1 zero is there then will compute product of entire array by skipping that one zero and during computing ans array we will put zero in all ans[i] and when we encounter zero we will put product in that case ! Maybe this will work!
We can do it by using division operation also. But according to this constraint it is of no value. class Solution { public: vector productExceptSelf(vector& nums) { vector vt; int p=1,z=1,flag=0,c=0,co=0; for(int i=0;i
Great Explanation
Bhai ye O(1) extra space me bhi ban jayga just need to take the count lf zeros if zeros are more than 1 no matter what all values will be zero of zeros are 1 for sure that vak can be calculated and if no zeros in the array it's fine as well
Count the Zeroes , if more than 1 zeroes are there then entire ans array will be Zero , but if only 1 zero is there then will compute product of entire array by skipping that one zero and during computing ans array we will put zero in all ans[i] and when we encounter zero we will put product in that case ! Maybe this will work!
question tells us that don't use division operator
10:29 "remember the fact" "maksad nhi bhulna"
Thank you 😊
NICE, BROTHER. KEEP POSTING SUCH DAILY CHALLENGES! THANKS.
We can do it by using division operation also. But according to this constraint it is of no value.
class Solution {
public:
vector productExceptSelf(vector& nums) {
vector vt;
int p=1,z=1,flag=0,c=0,co=0;
for(int i=0;i
nice
how come multiplying 30 , 10^5 times makes 30*10^5 ?? it should be 30^(10^5)
ladu aram se bolkr
Ye sb band karo do ab...devin kar dega
Devin ko bhi Human ( programer) to Kal kon Tum bhi bana sakte ho