DPKG Error : Sub-process /usr/bin/dpkg returned an error code (1)

While installing some software using linux terminal, we may encounter error like this

Sub-process /usr/bin/dpkg returned an error code (1)

I got this error while installing a library file “libpam0g:i386”.

Dpkg - Error

Just see the 4th line of this error.

dpkg: error processing /var/cache/apt/archives/libpam0g_1.1.3-7ubuntu3_i386.deb (–unpack):

The error can be rectified by using the command

sudo dpkg -i –force-overwrite /var/cache/apt/archives/libpam0g_1.1.3-7ubuntu3_i386.deb



Problem Statement

Given a range to b, we have to all numbers which have prime number of divisors.

Eg: In the range 1 to 10 , the numbers are 2, 3, 4, 5, 7, 9

For a brief problem statement visit this link.

Continue reading

Hackerrank 101oct Halloween party


You are given a very large rectangular chocolate bar. You must cut only as 1 x 1 pieces. You are allowed to do only ‘K’ cuts at the maximum. What is maximum number of chocolate pieces can u cut ?

For a detailed problem statement click here

Continue reading

Topcoder SRM 595 DIV2 250

Problem Statement

In short, You are given a string containing only characters R,G,B. We can remove the string from either end at each move( from left or from right). Finally, the string must contain only R or G or B.

You can find a detailed problem description here.

Continue reading


Problem Statement

Let ‘A’ be a R x C  Matrix. Elements in ‘A’ are filled from 1 to R*C in row-major order. ‘B’ is also a R x C Matrix where the elements are filled in column-major order.

Find number of cells which satisfy the property Ai,j ==  Bi,j.

For a brief problem statement click here.

Continue reading

Topcoder SRM 594 DIV2 250

Problem Statement

In a nutshell, Given a M x N Matrix we have to check whether it is possible to visit all the cells starting from any location.

Moving Direction – If you are in the cell (x,y), you can only move to ( (x+1)%M, (y+1)%N )

You can find a detailed problem description here.

Continue reading