For negative numbers, we often convert them to their equivalent positive number. For instance, take -1 and a positive integer k. When we compute (-1 % k), the result is -1. Adding k to this result gives (k - 1), which is a valid positive remainder. Thus, we don’t need to perform another %k operation because (k - 1) is already within the range of 0 to (k - 1), which are the possible remainders when dividing by k. so why are we doing extra %k ((-1 %k)+k) %K what is the need of the %K which is outside the brakets.
Thanks for your video. However, I just dont understant why are not we doing '( num1+nums2)/k == 0'. This will aslo produce the same result. Can you explain this. Why do we even need to check num1 reminder and num2 reminder and then check their sum.
bhai ek baat btao yaar question dekh ke pata kaise chalega ki ye concept use hoga mai. main ti nai soch paya ki aisa bhi kuch ho sakta hai maine toh basic 2 pointer Socha tha class Solution { public boolean canArrange(int[] arr, int k) { Arrays.sort(arr); int half=arr.length/2; int i=0; int j=arr.length-1; int c=0; while(ik) { j--; }else{ i++; } } if(c==half) { return true; } return false; } } maine around 350 questions solve kar liye hai fir bhi new problem me dikkat aait hai please reply
Like target for this video 130. Please do like if you were able to understand this question!😄😄
Sorry but I am understand please explain code properly 😔
❤❤❤
first person to watch 100%
For negative numbers, we often convert them to their equivalent positive number. For instance, take -1 and a positive integer k. When we compute (-1 % k), the result is -1. Adding k to this result gives (k - 1), which is a valid positive remainder. Thus, we don’t need to perform another %k operation because (k - 1) is already within the range of 0 to (k - 1), which are the possible remainders when dividing by k.
so why are we doing extra %k ((-1 %k)+k) %K what is the need of the %K which is outside the brakets.
What a wonderful explanation bhaiya
Shashwat sir you are my god and you look like my Big brother so i am understand easily.
means a lot ❤
sir could you give us references of " complementry remainder for integer" that you have used in line no. 5 😍😍...
Sir, please tell me a approx time in which your DSA playlist will complete, so I can make my plan for future, please reply sir 🙏🏻🙏🏻🙏🏻
❤
sir which pentab you use for notes?
xp pen tablet deco 01 v2
Sir, why u haven't taken (1,4) that is also divisible by 5 right
(1,4) lelo. multiple combinations ban skte hai na...
How you come with the logic of remainder and creation of the array?
I have solved similar questions
Thanks for your video.
However, I just dont understant why are not we doing '( num1+nums2)/k == 0'. This will aslo produce the same result. Can you explain this.
Why do we even need to check num1 reminder and num2 reminder and then check their sum.
You won't be able to check for the negative numbers with this approach
bhai ek baat btao yaar question dekh ke pata kaise chalega ki ye concept use hoga mai. main ti nai soch paya ki aisa bhi kuch ho sakta hai
maine toh basic 2 pointer Socha tha
class Solution {
public boolean canArrange(int[] arr, int k) {
Arrays.sort(arr);
int half=arr.length/2;
int i=0;
int j=arr.length-1;
int c=0;
while(ik)
{
j--;
}else{
i++;
}
}
if(c==half)
{
return true;
}
return false;
}
}
maine around 350 questions solve kar liye hai fir bhi new problem me dikkat aait hai please reply