Wednesday, September 14, 2016

Mindfulness

I consider few cases to explain the importance of  MINDFULNESS.


Case 1:


One day my friend and i planned to go out,When we are starting from our place my friend got a doubt whether she locked the door or not.she was unable to recollect what exactly happened.Why do you think she was unable to recollect ??

Case 2:


The Project Manager assigned a project to the team.In that team Raj is afraid of deadlines.He often looks stressed and tensed.Why do you think Raj looks stressed and tensed ??

Case 3:



When a student don't listen to the class ,the teacher says your body is present and the mind is absent.Why do you think the student didn't listen to the class ??

Not only in the above stated cases but also one faces difficulty in quick decision making,multi tasking,lack of concentration etc.Here comes the importance of Mindfulness...


What is Mindfulness?


Mindfulness is the state of being conscious and one's awareness on the present moment.

When you are Mindful you observe your thoughts and feelings from a distance without judging them good or bad.

How to practice Mindfulness?


The practice of Mindfulness through Meditation changes the wiring and the makeup of our brains.

There are different methods in Meditation.One of the methods is  Concentration on Breathing.

To practice this method

1. choose a pleasant and a calm place.

2. Sit in a comfortable way as you wish but try to keep your hands together and the legs one over the       other in a overlapped way.

3. Then try to concentrate on your breath .

4. When trying to concentrate on your breath a lot of thoughts come into the mind.Let it be.You try to concentrate on your breath.


I conclude by a quote " Drink your tea slowly and reverently as if it is the axis on which 

the world earth revolves without rushing toward the future.Live the actual moment.Only this 

moment is life ".





Tuesday, November 24, 2015

Hackerrank -> Algorithms -> Strings -> Anagram

Anagram


The following is the solution for Anagram in C passed all the test cases.

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int test,i,len,str1[26],str2[26];
int count;
char input[10000];
scanf("%d",&test);
while(test--)
{
 scanf("%s",input);
 len=strlen(input);
 if(len%2!=0)
            printf("-1\n");
 else{
 count=0;
 for(i=0;i<26;i++)
 {str1[i]=0;
 str2[i]=0;}
 for(i=0;i<len/2;i++)
            str1[input[i]-97]++;
 for(i=len/2;i<len;i++)
            str2[input[i]-97]++;
 for(i=0;i<26;i++) {
            if(str1[i]>=str2[i])
                        count=count+(str1[i]-str2[i]);
            else
                        count=count+(str2[i]-str1[i]);
            }
 printf("%d\n",count/2);
}
}
   /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    return 0;
}


Saturday, November 21, 2015

Algorithms -> Strings -> Gemstones

Gemstones


Today I sovled this.The following is the solution for Gemstones in C passed all the test cases.


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() {
char rock[100];
int test,i,a[26]={0},j,count=0;
//printf("\nenter number of test cases:");
scanf("%d",&test);
for(i=0;i<test;i++)
{
//printf("\nenter the string:");
scanf("%s",rock);
for(j=0;rock[j]!='\0';j++)
{
if(a[rock[j]-97]==i)
a[rock[j]-97]++;
}
}
for(i=0;i<26;i++)
{
 if(a[i]==test)
            count++;
}
//printf("the common element is:%d",count);
    printf("%d",count);
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    return 0;
}




Tuesday, November 17, 2015

Message to all the Parents.......

          Today i want to say about one of the major  trouble faced by the children. The trouble faced is the communication gap between the parents and children.When someone ask the parents about their children,"Are your children happy?".Most of the parents reply that our children are happy because we are giving children the costly dresses,gifts and toys etc.But the children are not actually happy,as they require their parents valuable time and love along  with the dresses,gifts etc.

If the parents don't do this below mentioned some of the problems faced by the children.

       1. Lack of self confidence.
    2. For every task they are going to perform they lack  some steps behind to the finish line.
     3. If the parents encourage their children to achieve the goal/complete the task in this way .They always say to their children that you should do this/win this .But the parents will not give the way and their past experiences related to that inorder to achieve the goal/complete the task.Due to this there will be stress in the children.
    4. The children feel that friends are more important  to them than the parents because of the love and  affection of the friends towards them.

If the parents spend their valuable time and love with their children .The below mentioned are some of the outcomes.

          1. The children will feel confident and they possess self respect.
2. Mutual understanding ,cooperation and coordination between the parents and the children will be grown.
3. If they provide the love and affection which is given by their friends ,the children feel more happy since they are receiving their parents love in a friendly way .As a a result of this the parents will be knowing about their children.

And finally the ultimate outcome from their children is they become as a "GEM".
          To all the parents/children ,if your children/parents don't talk to you don't misunderstand them .Try to talk with them .If both the parents and the children understand themselves in a
positive way the happiness experienced by both of them can't be expressed in words.
The reason why i wrote this is i have observed this problem in my friends and my parents love ,affection and encouragement to me in each and every aspect .Thank you God.

Sunday, November 15, 2015

Algorithms -> Strings -> Alternating Characters

Alternating Characters


The following is the solutions for alternating characters in C

For every character there should be an opposite character ,until the opposite character is found cancel it and modified the cancelled character to '*'.


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
void AlternatingCharacters(char str[100000],int n)
{
 int i=0,j,del=0;
 while(i<n)
 {
  j=i+1;
while(j<n)
{
 if(str[i]==str[j])
 {
  str[j]='*';
  del++;
  j++;
 }
 else
  break;
}
 i=j;
 }
printf("%d\n",del);
}
int main() {
int testcases,i,n;
char string[100000];
scanf("%d",&testcases);
for(i=1;i<=testcases;i++)
{
scanf("%s",&string);
n=strlen(string);
AlternatingCharacters(string,n);
}
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */  
    return 0;
}



Thought of change................

This is the first day im going to write onto the blog.I want to say the reason behind why i kept the

title as "An idea can change u..to become a good hacker".In one of the placement drives happened

 in our college,only few were shorlisted in the written test and im one among them.I dont believe till

that time that i can do it.The next rounds of it is based on logic and coding.I failed in writting the

code.Finally i got eliminated.Then i started to analyse why i got eliminated,then i got an idea that

so as to do better in this practice practice...... is needed.Then i started practicing the

coding,before i used to just listen to classes...