Sunteți pe pagina 1din 1

1.

Given an integer expression in a prefix format (i.e. the operator precedes the n
umber it is operating on) , print the expression in the post fix format .
Example: If the integer expression is in the prefix format is *+56-78, the postf
ix format expression is 56+78-*. Both of these
correspond to the expression (5+6)*(7-8).
2.
Given an array containing sequence of bits (0 or 1), you have to sort this array
in the ascending order i.e. all 0' in first part of array followed by all 1's.
The constraints is that you can swap only the adjacent elements in the array.
Find the minimum number of swaps required to sort the given input array.
Example: Given the array (0,0,1,0,1,0,1,1) the minimum number of swaps is 3.
Note: You just need to complete the function given below for this task. The fu
nction is given a binary string as input and returns the required answer
3.
Given two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where x2>=x1 and
y2>=y1. Find the total number of distinct paths between (x1, y1) and (x2, y2). Y
ou can only move in right direction i.e. positive x direction (+1, 0) or in up d
irection i.e. positive y direction (0, +1) from any given position.
Example: If the given coordinates are (3,3) and (5,5), the number of distinct
paths are 6 : one going through 3,5 ; one going through 5,3 and four going thro
ugh 4,4.

S-ar putea să vă placă și