Programming Trick's
Android examples and Java Programming Concept's...!
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...
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));
}
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;
}
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);
}
Print the Prime numbers upto N number .
void primes(int n){
int primes[] = new int[105];
for(int i=0;i
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;
}
Click here to claim your Sponsored Listing.
Category
Contact the business
Telephone
Website
Address
Pune
411016