For the last problem, there is a permutation that is always valid: print odd numbers in a descendant order, then print the even numbers in ascendant order (swap 2 and 4 to match the diff condition)
Yes, that is the first thing I also considered. For odd n: 1, 3, 5, 7, ..., n, n - 3, n - 1, n - 5, n - 7, n - 9 ... is a valid sequence. For even n: 1, 3, 5, 7, ..., n-1, n - 4, n, n - 2, n - 6, n - 8, n - 10 .... is a valid sequence.
Ended up 4th, since it was a Divison 4 contest. Will end up 3rd, since it will be a Divison 3 contest. Will end up 2nd, since it will be a Divison 2 contest. Will end up 1st, since it will be a Divison 1 contest.
*hey* may be *you* guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
@@rohitpal7739 hey may be you guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
Rohit Pal hey may be you guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
I found another elegant(imo) solution for G, first it is obvious for n < 4 it's impossible for n = 4 you can have 3 1 4 2 now, for every increasing n, add odd numbers to the left and even numbers to the right. for example if n = 7, add 7 and 5 to the left of 3 1 4 2, and 6 to the right. 7 5 3 1 4 2 6 and so on :)
Rohit Pal hey may be you guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
Hi William! I really enjoy your videos! Could you perhaps do another post on how you improve your programming skills. I would like to get better with coding logic but I am hitting some walls, for example coding logic of hackerrank's easy to medium section. Is there reference material that you read to get better?
Hey, I literally took 4 minutes to understand 2'nd problem (B) but you solved it in less than 3 minutes How how how? Please tell us How are you able to think this much faster, Do you have old experience of these problems or you came across these problems first time
Great video William, do you have any advice to learn c++ as a beginner, I know java (programming) but I am trying to learn c++, any advice would be really helpful.
I was really scared from c++. Just couldn't switch from python. Now I find cpp better in many situations. I would give you an honest advice. Mostly people will say read this read that. I'll say, just learn 3 - 4 important operations of all stl data structures by googling their name like map set vector etc. Almost everything in cp is done using those 90% of the time.
hey may be you guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
For G, you can just go 2 4 6 8 ... then go back in reverse for the odds but by changing a couple of things. Like for n = 10, you can do 2 4 6 8 10 7 9 5 3 1. Just a change in the order of 7 and 9. Another method can be placing the elements in 4 groups based on their value mod 4. Then printing all 0 mod 4 in ascending order, then 1 mod 4 in descending order, then 2 mod 4 in ascending and 3 mod 4 in descending.
hey may be you guys are good coders ... Please help me guys .. I have only 1 year to learn programiing and build some good skills so i will get a good job... I am learning C language still please reply anyone.. What to do after C .. For getting place ld in companies like amazon, paytm
@@gameplayvideos3113 have u ever hear abt typos ....or rather say typing errors nevertheless u will say u don't even know the spelling ........lol ...i don't mind u corrected my mistake, in fact, I will prove u wrong by practising and grooming my skills ...have a great life ahead
In C, here is my method, which I'm proud of: The answer is ((N - 1) / K)*K + (N - 1)*K ( - 1 if (N - 1) % K == 0) Don't ask me why. I hope that intuition method is hack-immune (correct)
Did you do math competitions before competitive programming? Also, do you know discrete math? If so, would you say that discrete math has helped you, whether directly or indirectly in solving these questions?
Output For each test case print: YES and the required values ai, *if the answer exists (if there are several answers, print any of them)* For such type of questions its better to not look at the testcases, come up with your own approach that satisfies the question. The testcases are designed in a way to trick you, so you start spending time on how to get output like the test cases and eventually you don't solve the problem