Labels
android
Assembly Language
bash
Beagle Bone Black
c
c++
CL1
competitive programming
compiler
computer vision
data structure
database
dsps
encryption
games
graphs
hacks
java
linux
lisp
MIL
monte carlo algo
MPAL
networking
OOMCPL
osa
perl
pl
PL -3
PL-1
PL-2
PL-4
python
qt
recursive algorithms
Scala
security
sorting
storage
terminal
ubuntu
utilities
Showing posts with label competitive programming. Show all posts
Showing posts with label competitive programming. Show all posts
Sunday, 16 July 2017
Friday, 14 July 2017
Thursday, 13 July 2017
Competitive Programing: Vowel Substring
Q: Given a string find all the number of sub-strings which contain all the five vowels at least once.
It is solved in two ways:
It is solved in two ways:
- A slightly more complicated linear scan method
- By generating all the sub-strings and then checking whether or not it satisfies the our requirements. (brute force)
Tuesday, 11 July 2017
UVa 00637 - Booklet Printing
This problem is an adhoc problem that asks to you to design a system to print folding booklets. The problem description and test cases can be found here.
Tuesday, 4 July 2017
Uva 278 - Chess
This problem is one of the best ad-hoc problems I have come across - simple but thought provoking. It asks you to the maximum number of rooks, queens, kings or knights you could place on n*m chess board such that no piece attack another.
Given that 4<=m,n<=10.
Given that 4<=m,n<=10.
Monday, 3 July 2017
Summing the digits of a number in C++
Q: This is a simple ad-hoc problem which asks to sum up the digits of a number repeatedly until the sum is less than 10. We are required to stop the program when input given is 0.
Sunday, 2 April 2017
Generating Permutation in Python
This is the best way to generate permutations in python.
from itertools import permutations j="1234" for i in permutations(j): print "".join(i)
Wednesday, 7 December 2016
Maximum subarray problem
Problem Statement
Finding a contiguous sub-array which has the largest sum in an 1-D array.Algorithm
This problem is solved by using Kadane Algorithm. This algorithm is a linear time algorithm.Tuesday, 1 November 2016
Saturday, 29 October 2016
Fenwick Tree to Maintain A count of number of even numbers
Tuesday, 25 October 2016
Python Sets:Checking whether a given string contains all the vowels in english language
Q: To check whether the given string contains all the vowels in english language.
Friday, 2 September 2016
Common Logical Errors in C and C++
Today I spent over two hours discovering this stupid mistake in my code.
Thus I came up with the idea to make a cheat-sheet for common programing mistakes. I hope this is useful to you during your practical exams preparations, debugging times and coding competitions. In case, I have not mentioned one of the mistakes that you make just leave a comment and I will add it.
a=a++;
Thus I came up with the idea to make a cheat-sheet for common programing mistakes. I hope this is useful to you during your practical exams preparations, debugging times and coding competitions. In case, I have not mentioned one of the mistakes that you make just leave a comment and I will add it.Thursday, 1 September 2016
Finding primes in a range of numbers
The fastest way(yet easy to understand and implement) to test a prime number is Rabin-Miller Prime Test. However, it suffers from two issues:
Sieve Algorithm on the other hand, uses previously generated results and works faster when determining the primes in a range.
Here is a code snippet for the same
- It is suitable for a single number
- It may give false positives
Sieve Algorithm on the other hand, uses previously generated results and works faster when determining the primes in a range.
Here is a code snippet for the same
Monday, 29 August 2016
Subscribe to:
Posts (Atom)
