About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

মঙ্গলবার, ২৩ জুন, ২০১৫

UVA :482 - Permutation Arrays

#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>

using namespace std;


int main()
{

   // freopen("in.txt","r",stdin);
   // freopen("out.txt","w",stdout);
    int test;
    cin>>test;
    vector <pair<int,string> > vi;
    int in;
    string ss;
    char str[100];
    getchar();
    for(int cas=1; cas<=test; cas++)
    {

        getchar();


        string a,b;
        vi.clear();
        getline (cin,a);
        getline (cin,b);
        stringstream x (a);
        stringstream y(b);
        while(x>>in)
        {
            y>>ss;
            vi.push_back(make_pair(in,ss));

        }

        sort(vi.begin(),vi.end());


        if(cas>1) printf("\n");
        for(int i=0; i<vi.size(); i++)     cout<<vi[i].second<<endl;

    }



    return 0;
}

শুক্রবার, ১২ জুন, ২০১৫

Timus Solution :1567. SMS-spam

#include <bits/stdc++.h>
#define ll long long
#define scd(a,b) scanf("%d %d",&a,&b)
#define sc(a) scanf("%d",&a)

using namespace std;

int main()
{
   // freopen("in.txt","r",stdin);
    map<char,int>mp;
    for(int i=1,j=97,k=98,l=99; i<=9; i++,j+=3,k+=3,l+=3)
    {
        char x=(char)j;
        mp[x]=1;
        char y=(char)k;
        mp[y]=2;
        char z=(char)l;
        if(i<9) mp[z]=3;

    }
    mp['.']=1;
    mp[',']=2;
    mp['!']=3;
    mp[' ']=1;
   // mp['#']=2;
    string str;
    getline(cin,str);
    int sum=0;
    for(int i=0; i<(int)str.size(); i++)
    {

      if(str[i]!='#')  sum+=mp[str[i]];

    }
    cout<<sum<<endl;

    return 0;
}

বৃহস্পতিবার, ১১ জুন, ২০১৫

Light oj :1088 - Points in Segments solution

#include <bits/stdc++.h>

using namespace std;
int bsl(int *ary,int target,int n)
{
    int low=0,high=n,mid;
    while(low<=high)
    {
        mid=(low+high)>>1;
        if(ary[mid]==target)
        {
            return mid;
            if(ary[mid-1]==target) high=mid-1;

        }
        else if(ary[mid]>target) high=mid-1;
        else low=mid+1;


    }

    return low;
}



int bsh(int *ary,int target,int n)
{
    int low=0,high=n,mid;
    while(low<=high)
    {
        mid=(low+high)>>1;
        if(ary[mid]==target)
        {
            return mid;
            if(ary[mid+1]==target) low=mid+1;

        }
        else if(ary[mid]>target) high=mid-1;
        else low=mid+1;


    }

    return high;
}

int main()
{

 //   freopen("in.txt","r",stdin);
    int test;
    int ary[100005];
    scanf("%d",&test);
    for(int cas=1; cas<=test; cas++)
    {
        int n,q;
        scanf("%d %d",&n,&q);
        for(int i=0; i<n; i++) scanf("%d",ary+i);
        printf("Case %d:\n",cas);
        while(q--)
        {
            int low,high;
            scanf("%d %d",&low,&high);
            int l=bsl(ary,low,n-1);
            int h=bsh(ary,high,n-1);
           // cout<<h<<l<<endl;
            printf("%d\n",(h-l)+1);

        }


    }
    return 0;
}

শুক্রবার, ৫ জুন, ২০১৫

UVA SOLUTION : 256 - Quirksome Squares

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d %d",&a,&b);

using namespace std;
void digit2();
void digit4();
void digit6();
void digit8();

int main()
{
    // freopen("in.txt","r",stdin);
    int digit ;
    while(~ sc(digit))
    {
        if(digit==2) digit2();
        if(digit==4) digit4();
        if(digit==6) digit6();
        if(digit==8) digit8();

    }

    return 0;
}
void digit2()
{


    for(int i=0; i<10; i++)
    {
        for(int j=0; j<10; j++)
        {
            if(((i+j)*(i+j))== ((i*10)+j)) cout<<i<<j<<endl;
        }
    }
}

void digit4()
{

    for(int i=0; i<10; i++)
    {
        for(int j=0; j<10; j++)
        {
            for(int k=0; k<10; k++)
            {
                for(int l=0; l<10; l++)
                {
                    int s=((i*10)+j)+((k*10)+l);
                    int x=(i*1000)+(j*100)+(k*10)+l;
                    if(s*s==x)cout<<i<<j<<k<<l<<endl;
                }
            }
        }
    }




}
void digit6()
{

    for(int i=0; i<10; i++)
    {
        for(int j=0; j<10; j++)
        {
            for(int k=0; k<10; k++)
            {
                for(int l=0; l<10; l++)
                {
                    for(int m=0; m<10; m++)
                    {
                        for(int n=0; n<10; n++)
                        {
                            int x=(((i*100)+(j*10)+k) +((l*100)+(m*10)+n));
                            int s=(i*100000)+(j*10000)+(k*1000)+(l*100)+(m*10)+n;
                            if(x*x==s)cout<<i<<j<<k<<l<<m<<n<<endl;
                        }
                    }
                }
            }
        }
    }



}

void digit8()
{

    for(int i=0; i<10; i++)
    {
        for(int j=0; j<10; j++)
        {
            for(int k=0; k<10; k++)
            {
                for(int l=0; l<10; l++)
                {
                    for(int m=0; m<10; m++)
                    {
                        for(int n=0; n<10; n++)
                        {
                            for(int o=0; o<10; o++)
                            {
                                for(int p=0; p<10; p++)
                                {
                                    int x=(((i*1000)+(j*100)+(k*10)+l) +((m*1000)+(n*100)+(o*10)+p));
                                    int s=(i*10000000)+(j*1000000)+(k*100000)+(l*10000)+(m*1000)+(n*100)+(o*10)+p;
                                    if(x*x==s)cout<<i<<j<<k<<l<<m<<n<<o<<p<<endl;
                                }
                            }
                        }
                    }
                }
            }
        }
    }



}