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 :290 - Palindroms <---> smordnilaP

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("in.txt","r",stdin)
#define MV 20
using namespace std;

typedef long long ll;

//typedef vector<string>vc;
//vector<vc>graph;
//graph.assign(r+2,vc());
int graph[1005][1005];
bool visited[1005][1005];
int xr[]= {-1,-1,-1,0,0,1,1,1};
int yc[]= {-1,0,1,-1,1,-1,0,1};
int rr[]= {0,-1,0,1};
int cc[]= {-1,0,1,0};
int b,cnt,x,y,z,rem;


void step( int base,string str)
{
    // cout<<str<<" ";
    int l=str.size();
    string s=str;
    reverse(s.begin(),s.end());

    string ans;
    // cout<<str<<" "<<s<<endl;
    for(int i=l-1; i>=0; i--)
    {
        char ch=str[i];
        if(ch=='E') x=14;
        else if(ch=='D') x=13;
        else if(ch=='C') x=12;
        else if(ch=='B') x=11;
        else if(ch=='A') x=10;
        else x=ch-'0';



        ch=s[i];
        if(ch=='E') y=14;
        else if(ch=='D') y=13;
        else if(ch=='C') y=12;
        else if(ch=='B') y=11;
        else if(ch=='A') y=10;
        else y=ch-'0';
        z=x+y+rem;
        rem=z/base;
        int d=z%base;

        if(d==14) ans+="E";
        else if(d==13) ans+="D";
        else if(d==12) ans+="C";
        else if(d==11) ans+="B";
        else if (d==10) ans+="A";
        else ans+=(d+'0');

    }
    if(rem>0)ans+=(rem+'0');
    reverse(ans.begin(),ans.end());
    // cout<<ans<<endl;
    string t=ans;
    reverse(t.begin(),t.end());
    // cout<<t<<endl;
    if(ans==t)
    {
        // cout<<endl;
        if(base!=15) cout<<" "<<cnt+1;
        else cout<<cnt+1;
        return ;
        // return cnt;
    }
    else
    {

        //cout<<ans<<endl;
        rem=0;
        cnt++;
        step( base,ans);
    }


}

int main()
{
   // READ;
   // freopen("out.txt","w",stdout);
    string str;
    while(cin>>str)
    {
        for(int base=15; base>=2; base--)
        {
            //if(base<15) cout<<" ";
            cnt=0;
            rem=0;

            string ss=str;
            sort(ss.begin(),ss.end());
            int l=ss.length();
            char ch=ss[l-1];
            if(ch=='E') b=14;
            else if(ch=='D') b=13;
            else if(ch=='C') b=12;
            else if(ch=='B') b=11;
            else if(ch=='A') b=10;
            else b=ch-'0';
            if(b>=base)
            {
                if(base<15) cout<<" ";
                printf("?");
                continue;

            }
            // cout<<cnt+1<<endl;

            string sss=str;
            reverse(sss.begin(),sss.end());
            if(sss==str)
            {

                if(base<15) cout<<" ";
                printf("0");
                continue;

            }

            step(base,str);

        }
        printf("\n");

    }


    return 0;
}

বৃহস্পতিবার, ৩ সেপ্টেম্বর, ২০১৫

UVA LIVE ARCHIEVE : 6758 - Balloons Colors

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define MV 20
using namespace std;

int main(){
   // READ;
   int test,arr[102];
   sc(test);
   while(test--){
       int n,x,y;
          sct(n,x,y);
          for(int i=0;i<n;i++) sc(arr[i]);
                if(arr[0]==x&&arr[n-1]==y) puts("BOTH");
                   else if(arr[0]==x&&arr[n-1]!=y) puts("EASY");
                      else if (arr[0]!=x&&arr[n-1]==y) puts("HARD");
                         else puts("OKAY");
      }


return 0;
}










Regionals 2011 >> - Arab Contest (UVA LIVE Archive 6007 - Arabic and English)

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define MV 20
using namespace std;

int main()
{
    // READ;
   // freopen("output.txt","w",stdout);
    int test;
    sc(test);
    string str,s;
    vector<string>vc;
    while(test--)
    {

        int n;
        cin>>n;
        vc.clear();
        getchar();
        getline(cin,str);
        s=str;
        // cout<<str<<endl;
        stringstream st;
        st<<str;
        bool alpha=false;
        bool Hash=false;
        while(st>>str)
        {
            if(isalpha(str[0])) alpha=true;
            if(str[0]=='#') Hash=true;
            vc.push_back(str);
            //  cout<<str<<endl;
        }
        int len=vc.size();

//        for(int i=0;i<len;i++) cout<<vc[i]<<" ";
//        cout<<endl;
        if(!alpha||!Hash) cout<<s<<endl;
        else
        {
            int index;
            for(int i=0; i<len; i++)
            {
                string ss=vc[i];
                if(isalpha(ss[0]))
                {
                    index=i;
                    break;
                }
            }
            for(int i=index+1; i<len; i++)
            {
                cout<<vc[i]<<" ";
            }
             cout<<vc[index];
            for(int i=0; i<index; i++)
            {
                cout<<" "<<vc[i];
                //if(i<index-1) cout<<" ";
            }
            cout<<endl;
          //  printf("\n");

        }

    }

    return 0;
}

বুধবার, ২ সেপ্টেম্বর, ২০১৫

Regionals 2011 >> Africa/Middle East - Arab Contest (ACM ICPC LIVE ARCHIVE 6008) - Between the Mountains

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define MV 20
using namespace std;

int main()
{
 //   READ;
    int test,x,y;
    sc(test);
    int a[10004],b[10004];
    while(test--)
    {
        sc(x);
        for(int i=0; i<x; i++) sc(a[i]);
        sc(y);
        for(int i=0; i<y; i++) sc(b[i]);
        int res=0x7fffffff;
       // cout<<res<<endl;
        for(int i=0; i<x; i++)
        {
            for(int j=0; j<y; j++)
            {
               res=min(res,(abs(a[i]-b[j])));
            }

        }
        cout<<res<<endl;

    }
    return 0;
}

UVA: 594 - One Little, Two Little, Three Little Endians

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define nnn 20
using namespace std;

int main()
{
    int n,res,pos,x;
    while(~sc(n))
    {
        res=pos=0;
        x=24;
        for(int i=1; i<=4; i++)
        {
            for(int j=x; j<x+8; j++)
            {
                if(n&(1<<j))
                {
                   res|=(1<<pos);

                }
                pos++;

            }
            x-=8;

        }
        printf("%d converts to %d\n",n,res);

    }

    return 0;
}

মঙ্গলবার, ১ সেপ্টেম্বর, ২০১৫

UVA :11933 - Splitting Numbers (way 2)

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define nnn 20
using namespace std;

int main()
{
    int num;
    int a,b,c;
    // scanf("%d",&n);

    while(~sc(num)&&num)
    {
        a=b=c=0;
        for(int i=0; i<32; i++)
        {
            if((num&(1<<i)))
            {
                c++;
                if(c%2) a+=(1<<i);
                else b+=(1<<i);

            }

        }
        cout<<a<<" "<<b<<endl;
    }

    return 0;
}

UVA :11933 - Splitting Numbers (way 1)

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define nnn 20
using namespace std;

int main()
{
    int num;
    int a,b;
   // scanf("%d",&n);

    while(~sc(num)&&num)
    {
        bitset<32>foo(num);
       // cout<<foo[0]<<" "<<foo[1]<<" "<<foo[2]<<endl;
       // cout<<foo.size()<<endl;
       // cout<<foo<<endl;
        int c=0;

        a=b=0;
        for(int i=0; i<32; i++)
        {
            if(foo[i]==1)
            {
                c++;
                if(c%2) a=a+(1<<i);
                else b=b+(1<<i);

            }


        }
        cout<<a<<" "<<b<<endl;


    }
    return 0;
}