Category: ACM

05
May
2017

How to take limited constraint 1

code: 1<=N<=10^5 1<=A[i]<=10^9 1<=M<=10^9 Source: https://www.facebook.com/groups/bengaliprogramming/permalink/717276125110930/

05
May
2017

Hackerearth: Linear Search Algorithm Problem

Default : Source: https://www.hackerearth.com/practice/algorithms/searching/linear-search/tutorial/ code: /* hackerearth linear search test */ #include<stdio.h> int main() { //long long int…

04
May
2017

Algo: Linear Search

code: /* Count Frequency in an Array(Optimized Version) Syed Ahmed Zaki — 2017 */ #include<stdio.h> int linear_search(int…

04
May
2017

Interview: Find Occurances in an Array – Binary Search Application

Some theory: code: /* Count Frequency in an Array Syed Ahmed Zaki — 2017 */ #include<stdio.h> int…

04
May
2017

Algorithm: Binary Search

iterative code: #include<stdio.h> int binarysearch(int A[],int n,int x) { int low=0, high=n-1; while(low<=high) { int mid=(low+high)/2; //eta…

21
Apr
2017

Count number of 2’s in a given range (0 to n)? (ex: range between 0-20, Ans: 3 (i.e [2], 1[2], [2]0))

Google Search: https://www.google.com/search?q=Counting+2s&ie=utf-8&oe=utf-8&client=firefox-b#q=Counting+2s+in+c SOlution: https://www.careercup.com/question?id=56794 //https://www.careercup.com/question?id=56794 #include<stdio.h> int main() { int n,i,j; int ctr=0; scanf(“%d”,&n); for(i=0;i<=n;i++) { for(j=i;j>0;j=j/10) {…