Saturday, 5 January 2019

my TO-DO list :

  1. http://codeforces.com/problemset/problem/148/A    using Inclusion-Exclusion Principle
  2. After completing entire ladder, revisit them again and try a diff approach

Monday, 15 October 2018

Behold the fBUG

Search for a range, a probelm in inerviewbit binary search section..... everything seems fine..i wrote a afunction based on the tutorial of mycodeschool and getting TLE coz of infinte loop for some trest case...
but instead of making func call using bool.... i  jz wrote exact copy of func..and got accepted....still dont understand why it happened .


https://www.interviewbit.com/courses/1/topics/4/problems/search-for-a-range/previous_submissions/
TLE : 11

AC : 12

Sunday, 19 August 2018

Trick to visit all 4 adj. blocks in a matrix

int di[]={1,-1,0,0}; // <-----THIS IS THE TRICK---|
int dj[]={0,0,1,-1}; // <------------------------------|

for(int i=0;i<4;i++){ // ALL FOUR ADJ. BLOCKS

    I=a+di[i];    
    J=b+dj[i];  
  if(I>=0 && I<r && J>=0 && J<c) //validation for borders
                       //CODE;
}

Sunday, 15 July 2018

AGC 026

A - Colorful Slimes 2
Remember the boundary cases.Missed coz of "off by one error"
yutaka1999 (contest Rank : 1)  sol's idea was diff. than mine but its useful ;)


Thursday, 12 July 2018

SPOJ - ELEVTRBL

SPOJ - ELEVTRBL

At first, my untrained mind doesnt got the BEAUTY of bfs....
MIND-BLOWN by the simple fact !!!
Cool !!!

Friday, 9 March 2018

13A-Numbers.... Simple, yet logical

Ref : http://codeforces.com/problemset/problem/13/A

Here, the nr and dr can be found easily, but they can be factored out by some number....
That's the tricky thing !!!
Happy Coding and stay *HUMBLE*

TLE jz for using printf() instead of putchar()

Exact same logic,but jz i used printf everywhere,but when i changed em to putchar(), BOOM
it's AC !!!!
left side - AC
right side - TLE

Also note that among two accepted codes,
1 is 62 ms
and other is 92 ms
HEED !!!