Search
 
SCRIPT & CODE EXAMPLE
 

C

lmkmaksmxkmakkxxamkskaamkamkaxsmkasm

1. You are given two numbers N and K.2. N represents the total number of soldiers standing in a circle having position marked from 0 to N-1.3. A cruel king wants to execute them but in a different way.4. He starts executing soldiers from 0th position and proceeds around the circle in clockwise direction.5. In each step, k-1 soldiers are skipped and the k-th soldier is executed.6. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed soldiers are removed), until only the last soldier remains, who is given freedom.7. You have to find the position of that lucky soldier.Note -> Check out the question video and write the recursive code as it is intended without  changing signature. The judge can't force you but intends you to teach a concept.
Comment

PREVIOUS NEXT
Code Example
C :: C programming statician 
C :: how to compress image in c 
C :: /usr/bin/mandb: fopen /var/cache/man/7935: Permission denied 
C :: Defining a macro in a header file 
C :: + ********************* 
C :: time to apply pmfby 
C :: bit wise operation 
C :: sdl_rect 
C :: sort vectors c 
C :: c declare float 
C :: c arrays 
C :: C printf Declaration 
C :: C Create struct Variables 
C :: default password raspberry pi 
Dart :: flutter wait for specific time 
Dart :: copy to clipboard flutter 
Dart :: dart datetime parse 
Dart :: switch to another flutter channel eg. $ flutter channel beta $ flutter channel stable 
Dart :: flutter textbutton autofocus 
Dart :: flutter get device width 
Dart :: how to get first word of a sentence in flutter 
Dart :: dart collection for 
Dart :: remove file extension from path dart 
Dart :: flutter animated opacity 
Dart :: DartPad requires localStorage to be enabled 
Dart :: disable flutter listtile 
Dart :: dart loop through object 
Dart :: replaceall dart 
Dart :: dart sort list by date 
Dart :: flutter baseline 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =