[Show all top banners]

helpjava11
Replies to this thread:

More by helpjava11
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 NEW PUZZLE for Sajha Intellects Day 6

[Please view other pages to see the rest of the postings. Total posts: 35]
PAGE:   1 2 NEXT PAGE
[VIEWED 19670 TIMES]
SAVE! for ease of future access.
The postings in this thread span 2 pages, View Last 20 replies.
Posted on 06-10-14 10:08 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

q. A total of thirteen pennies is put into three piles so
that each pile has a different number of pennies.
Obviously, this can be done in several ways. Here’s the
challenge – what is the fewest possible number of
pennies in the largest pile of any of the possible
combinations?
 
Posted on 06-10-14 10:22 AM     [Snapshot: 12]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 10:39 AM     [Snapshot: 31]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 10:40 AM     [Snapshot: 32]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

sorry, Serial is correct
 
Posted on 06-10-14 11:38 AM     [Snapshot: 63]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

How is Serial correct? Serial's largest pile is 6 and yours (and mine) is 5. The goal is to have fewest number of pennies in the largest pile. 5<6.
 
Posted on 06-10-14 11:46 AM     [Snapshot: 66]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

each pile has a different number of pennies
 
Posted on 06-10-14 12:28 PM     [Snapshot: 86]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 12:30 PM     [Snapshot: 90]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Got it. Ali logical puzzle sodhnu paryo bro, not trick questions.
 
Posted on 06-10-14 12:30 PM     [Snapshot: 91]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Q.
There are 1000 persons in a circle, numbered 1 thru 1000. Going around the circle, every second person is removed from the circle, starting with person number 2, 4, and so on. this is done repeatedly until one person is left. Which number person out of 1000 will that be?
 
Posted on 06-10-14 12:37 PM     [Snapshot: 109]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 12:40 PM     [Snapshot: 110]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 2:26 PM     [Snapshot: 161]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 2:53 PM     [Snapshot: 182]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 3:12 PM     [Snapshot: 189]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 
 
Posted on 06-10-14 3:19 PM     [Snapshot: 203]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Well, i also think its 1 now...First round ma sabai even numbers will get eliminated..so second round ma you start from 3 (alternate) and eliminate all odd numbers and 1 remains till the end...just a guess
 
Posted on 06-10-14 3:50 PM     [Snapshot: 226]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Gabbar Singn Bro: 2 round ma game complete hudaina ni ta...
First round: remove all even numbers.
remaining numbers: 1,3,5,7,9,11....999,
secoun round: remove alternate numbers .starting at 1 again.
remaining numbers: 1, 5, 9, 13 , 17....
third round...............
 
Posted on 06-10-14 5:14 PM     [Snapshot: 294]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

After every round the total number of people is even.
Every round starts from number 1.
From the first round, when the total number of people is even and the starting number is 1, the people on both sides of 1 go out but 1 remain.
Hence, survivor = 1.
 
Posted on 06-10-14 6:20 PM     [Snapshot: 329]     Reply [Subscribe]
Login in to Rate this Post:     1       ?     Liked by
 

Perfect answer by NAS: +2

Here is my version of code:

import java.util.ArrayList;
import java.util.List;


public class jpt1 {
static int toalPeople=1000;
static int result=0;
static int x;
static int count = 1000;
public static void main(String[] args) {
List result= numberLeft(toalPeople);
System.out.println("last remaining person: "+ result);

}

static public List numberLeft(int x){
ArrayList list = new ArrayList();
for (int i = 1; i <= toalPeople; i++) {
list.add(i);

}
System.out.println("list "+list);
while(count>1){
for (int i = 0; i < list.size()-1; i++) {
list.remove(i+1);
}
System.out.println(" Remaining people : "+list.size());
count = list.size();
}
System.out.println();


return list;
}
}
Output:
Remaining people : 500
Remaining people : 250
Remaining people : 125
Remaining people : 63
Remaining people : 32
Remaining people : 16
Remaining people : 8
Remaining people : 4
Remaining people : 2
Remaining people : 1

last remaining person: [1]
 
Posted on 06-10-14 7:00 PM     [Snapshot: 351]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Niral , Obama, Fuckeeto, Gabbar Singh also answered correctly but without solution so (+1) to each.

NAS bro, ur code is awesome as well and complete with user input. Thats the way it should be. I was trying to be fast, still have 2 unnecessary variable to be cleaned up.

 
Posted on 06-10-14 10:44 PM     [Snapshot: 388]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Helpjava11, that is wrong, either your programming is wrong (i don't have knowledge about programming) or something else is wrong. If you remove every second person in a circle, it will work until there is even no. like ...1000 to 500 to 250 to 125. If you remove, 2, 4, 6.......... 998, 1000, then no. 1 will be saved. But when you come to round 4th, after you remove 124th, 125th will be saved and no. 1 will be removed. Please write the no. in the circle and do it by yourself, and you will know it :)
 



PAGE:   1 2 NEXT PAGE
Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
I hope all the fake Nepali refugee get deported
Those who are in TPS, what’s your backup plan?
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
Travel Document for TPS (approved)
To Sajha admin
MAGA and all how do you feel about Trumps cabinet pick?
All the Qatar ailines from Nepal canceled to USA
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters