Вы находитесь на странице: 1из 2

**Given a char array with words in it, find all a characters and replace with xyz.

Modify the input array, do not create a copy of the array.


*You're given an array containing both positive and negative integers
and required to find the sub-array with the largest sum (O(N) ). Write a routin
e in java for the above.

**1. Give a string, print total count of substrings (length>=2) which are palind
romes. He was expecting better than O(n2) time complexity.

1: Given two strings S1 and S2.


Delete from S2 all those characters which occur in S1 also and finally,
create a clean S2 with the relevant characters deleted.
2.Find the first unrepeated character in a string of English language in O(n).?
3:Syntax:
#include <stdlib.h>
double atof( const char *str );

Description:
The function atof() converts str into a double, then returns that value. str mus
t start with a valid number, but can be terminated with any non-numerical charac
ter, other than "E" or "e".
Example:
x = atof( "42.0is_the_answer" );
RESULT: x set to 42.0
4) Given two arrays of numbers, find if each of the two arrays have the same set
of integers? Suggest an algo which can run faster than NlogN?
5) Given 2 set of arrays of size N(sorted +ve integers) find the median of the r
esultent array of size 2N (something better than storing the two arrays in one a
nd then sorting them).
5.5).Given a string 'abcdef' and another string 'efg' remove all occurences of
the characters in 'efg' from 'abcdef'. Write 'to ship' code and give test
cases. Design a program to test any implementation of this problem
6:Reverse a linked list.

6.6)Q6: Write a routine that takes as input a string such as ("aabbccdef"


and o/p "a2b2c2def" or "a4bd2g4" for "aaaabddgggg".
7:Given an array of characters which form a sentence of words
, give an efficient algorithm to reverse the order of the words (not characters)
in it.
8)5)Given an expression remove the unnecessary brackets in it with out creating
an ambiguity in its execution.
input output
ex1: (a+(b)+c) ----->a+b+c

ex2: (a*b)+c -------->a*b+c


9)Given an array of size n with first l positions filled with characters and a s
tring s ,replace all the instances of % with this string s,given that the lengh of
the array is sufficient to handle these substitutions.
input output
eg: abcdef%ghi% and ppp abcdefpppghippp
10)8. Given a long string and a given word find out how many times you can write
that word using subsets of the string.
(i.e., you can create "dog" with "doom dogged" 8 times.
11)Given an unsorted array, find the longest consecutive elements sequence.
Ex: 5 7 3 4 9 10 1 15 12
Ans: 3 4 5

12)10. Given a sorting order string, sort the input string based on the given so
rting order string.
Ex. sorting order string -> dfbcae
Input string -> abcdeeabc
output -> dbbccaaee
13). Convert an ASCII representation of a positive integer to it's numeric value
.
14)Given an array of strings, print them vertically.
E.g. cat, an, cool ?
c a c
a n o
t o
l

Вам также может понравиться