Programming Trick's

Programming Trick's

Share

Android examples and Java Programming Concept's...!

Apples and friends puzzle | Burning island | Lamp them up a puzzle | riddlesforyou | puzzles 29/01/2019

https://www.youtube.com/watch?v=v0LbSFVLOAs

1) Apple and friends puzzle
You have a basket containing ten apples. You have ten friends, who each desire an apple. You give each of your friends one apple.
Now all your friends have one apple each, yet there is an apple remaining in the basket.
How?
👍👍
2) Burning Island puzzle
How can all people survive the fire? (There are no buckets or any other means to put out the fire)
👍👍
3)Lamp them up a puzzle
You are in a dark room with a candle, a wood stove, and a gas lamp. You only have one match, so what do you light first?
👍👍

Apples and friends puzzle | Burning island | Lamp them up a puzzle | riddlesforyou | puzzles , , 1) Apple and friends puzzle You have a basket containing ten apples. You have ten friends, who each desire an apple. You...

12/08/2017

Java 8 Stream example to find the number greater than given number.
static void streamExample(){
List myList = new ArrayList();
for(int i=0;ip>90);
hiNum.forEach(p->System.out.println(p));
}

12/08/2017

Get Missing number from the list.
//return value will be the missing number.
static int getMissingNo(){
int [] a = {1,2,4,5,6};
int total = (a.length+1) * (a.length + 2)/2;
for(int i = 0; i< a.length;i++){
total -= a[i];
}
return total;
}

12/08/2017

Program to count the occurrence characters in the string.
void countCharOccurenceInString(String str){
char[] chars=str.toCharArray();
HashMap charCountMap= new HashMap();
for(char charStr:chars){
if(charCountMap.containsKey(charStr)){
charCountMap.put(charStr, charCountMap.get(charStr)+1);
}else{
charCountMap.put(charStr, 1);
}
}
System.out.println(charCountMap);
}

12/08/2017

Print the Prime numbers upto N number .
void primes(int n){
int primes[] = new int[105];
for(int i=0;i

26/02/2016

C Program For Doubly Linked List.




struct Node
{
int data;
struct Node* next;
struct Node* prev;
};
struct Node* head;
struct Node* GetNode(int);
void ReverseList();
void Print();
void insertAtHead(int);
void Print();
int main()
{
head=NULL;
insertAtHead(3);
insertAtHead(6);
insertAtHead(9);
Print();
ReverseList();
return 0;
}
void insertAtHead(int data)
{
struct Node* Newnode=GetNode(data);
if(head==NULL)
{
head=Newnode;
return;
}
head->prev=Newnode;
Newnode->next=head;
head=Newnode;
}
void ReverseList()
{
struct Node* temp=head;
while(temp->next!=NULL)
{
temp=temp->next;
}
while(temp!=NULL)
{
printf("%d->",temp->data);
temp=temp->prev;
}

}
void Print()
{
struct Node* temp=head;
printf("\n List is.");
while(temp!=NULL)
{
printf("%d->",temp->data);
temp=temp->next;
}
printf("\n");
}
struct Node* GetNode(int data)
{
struct Node* NewNode=(struct Node*)malloc(sizeof(struct Node));
NewNode->data=data;
NewNode->next=NULL;
NewNode->prev=NULL;
return NewNode;
}

Want your business to be the top-listed Computer & Electronics Service in Pune?
Click here to claim your Sponsored Listing.

Telephone

Address


Pune
411016