Wipro Programming Test

☞ Read an expression and remove parenthesis.(Nov,2018)
Sample Input
(A*B)+(C/D)-E
Sample Output
A*B+C/D-E

Click Here for Solution

☞ Read an expression and count number of valid parenthesis.(Nov,2018)
Sample Input
((A*B)+(C/D)-E)
Sample Output
3

Click Here for Solution

☞ Read an expression and check whether expression contains valid parenthesis or not.(Nov,2018)
Sample Input1
((A*B)+(C/D)-E)
Sample Output1
Valid
Sample Input2
((A*B)+(C/D-E)
Sample Output2
Invalid

Click Here for Solution

☞ Find a sub string in a given string and replace it with another string.
Sample Input1
lazy girl
girl
boy
Sample Output1
lazy boy
Sample Input2
lazy boy
boy
girl
Sample Output2
lazy girl

Click Here for Solution

☞ The least recently used (LRU) cache algorithm exists the element from the cache(when it's full) that was least recently used. After an element is requested from the cache, it should be added to the cache (if not already there) and considered the most recently used element in the cache.
Initially, the cache is empty. The input to the function lruCountMiss shall consist of an integer max_cache_size, an array pages and its length Len
The function should return an integer for the number of cache misses using the LRU cache algorithm.
Sample Input1
3 16
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0
Sample Output1
11
Sample Input2
2 9
2 3 1 3 2 1 4 3 2
Sample Output2
8

Click Here for Solution


No comments:

Post a Comment

Total Pageviews