Yashwant.K.Rao
BAN USER"If I asked the other guardian which door leads to heaven, what would he tell me?"
The door that the guardian specfies will be the one that leads to hell, so you know the other one leads to heaven.
This is because if you asked the guardian who tells the truth this question, he will tell the truth in that the other guardian will lie, and show you the door to hell. If you asked the guardian that always lies, he will lie by showing you the door to hell, because the other guardian would show you to door to heaven.
"If I asked the other guardian which door leads to heaven, what would he tell me?"
The door that the guardian specfies will be the one that leads to hell, so you know the other one leads to heaven.
This is because if you asked the guardian who tells the truth this question, he will tell the truth in that the other guardian will lie, and show you the door to hell. If you asked the guardian that always lies, he will lie by showing you the door to hell, because the other guardian would show you to door to heaven.
{ int FindLowest(const char *ptr, int k)
- Yashwant.K.Rao June 11, 201510 {
11 if(ptr == NULL || k < 1 || k >= sizeof(ptr)){
12 cout<<"Invalid Input"<<endl;
13 return 0;
14 }
15 int arr[10];
16 int index = -1;
17 //for(int count = 0; count < k; count++){
18 while(true){
19 if(k == 0){
20 while(*ptr != '\0'){
21 arr[++index] = *ptr;
22 ++ptr;
23 }
24 break;
25 }
26 if(*ptr == '\0'){
27 index = index - k;
28 break;
29 }
30 if(index >= 0){
31 while(arr[index] > *ptr){
32 index--;
33 k--;
34 if(index == -1 || k == 0){
35 break;
36 }
37 }
38 arr[++index] = *ptr;
39 } else {
40 arr[++index] = *ptr;
41 }
42 ++ptr;
43 }
44 for(int count = 0; count <= index; ++count){
45 cout<<arr[count] - 48;
46 }
47 cout<<endl;
48 }