K reverse a linked list with increasing K

Problem Reverse k elements in the linked list such that k goes on increasing Example Eg. 1 - 2 - 3 - 4 - 5 - 6 - 7 output - 1 - 3 - 2 - 6 - 5- 4 - 7 Solution You can take this problem here. Here we are just increasing k. public static ListNode<Integer> reverseSubLinkLists(ListNode<Integer> headerNode) { ListNode<Integer> nextNode = headerNode.next; ListNode<Integer> startNode = null; ListNode<Integer> endNode = null; int k = 2; while (nextNode ! [Read More]

Maximum number of chickens you cannot order

Problem There is a non vegetarian restaurant which sells chicken in orders of 6, 9 and 20. Calculate the maximum number of chicken pieces you cannot order from that restaurant ? Solution 43 If you analyze, then you will find that all the 6 numbers divisible by 3 can be ordered. Why? Because you can break them own as the sum of 6 and 9. Now after 26, all the numbers that are divisible by 3 if subtracted by 40 can be obtained. [Read More]