My issue
for even numbers like n = 8, why min is 3
shouldn’t it be 4, then no adjacents will be equal
Please help by pointing out my mistakes!
Here is my approach to solve this problem
My code
#include <stdio.h>
int main() {
// your code goes here
int t;
scanf("%d", &t);
while(t--)
{
int n;
scanf("%d", &n);
if(n%2 != 0)
printf("%d %d\n", (n/2)+1, n/2);
else if(n%2 == 0)
printf("%d %d\n", (n/2), (n/2));
}
}
Problem Link: The Man Code Practice Coding Problem