him4211
BAN USER 0of 0 votes
AnswersYou have given a string which consists of four characters {a,c,t,g}, find minimum length of unique substring which occurs only once.
 him4211 in United States
Eg:
Input :
#1 aacc
#2 actg
Output:
#1 2 3
#2 1 4
Explain:
aacc > {aa, ac, cc} are the smallest unique string with single occurrence. Report Duplicate  Flag  PURGE
Samsung Software Developer  0of 0 votes
AnswerHow to divide a circular array into k group of contiguous element such that difference between maximum sum and minimum sum is minimum. Each group have contiguous element of array. For e.g If the array is as follow. [6 13 10 2] and k=2 then o/p should be 18(6+10+2)13=5. As array is circular 6,10,2 are contiguous element of array.
 him4211 in India
For e.g If the array is as follow. [6 13 2 10] and k=2 then o/p should be 16(6+10)15(13+2)=1. As array is circular 6,10 are contiguous element of array.
For e.g If the array is as follow. [100 92 133 201 34 34 34 94 108] and k=4 then group as follow 208(108,100), 225(92,133), (201), 196(34,34,34,94) so 225196=29 Report Duplicate  Flag  PURGE
Samsung Software Developer Algorithm
package general;
import java.util.Arrays;
import java.util.TreeMap;
public class SieveOfEratosthenese {
public static void getPrimesBySeieveOfEraosthenes(int n, boolean primes[]) {
for(int i=2; i<= Math.sqrt(n); i++){
if(primes[i]){
for(int j=i*i;j<=n; j+=i){
primes[j] = false;
}
}
}
}
public static void main(String[] args) {
// TODO Autogenerated method stub
int n = 16;
boolean[] primes = new boolean[n+1];
Arrays.fill(primes, true);
getPrimesBySeieveOfEraosthenes(n, primes);
for (int i = 2; i <= n; i++) {
if (primes[i])
System.out.print((i) + " ");
}
TreeMap <Integer, Integer> sums = new TreeMap<>();
int sum =0;
for (int i = 2; i <= n; i++) {
if (primes[i]){
sums.put(i1, sum);
sum +=i;
}
}
if(primes[n]){
sums.put(n,sum);
}
System.out.println( "\n"+ sums.get(sums.ceilingKey(4)));
}
}

him4211
January 23, 2019
RepMarryJohan, Consultant at ASAPInfosystemsPvtLtd
I am successfully manage and coordinate graphic design projects from concept through completion. Create and conduct highly persuasive sales and ...
Repstacimdalton, Dev Lead at ASAPInfosystemsPvtLtd
At the moment I'm implementing Slinkies in the financial sector. My current pet project is researching break up a ...
Repcrystalblibby, Analyst at Achieve Internet
By professional i am teacher. Successfully supervised and assisted students, grade artwork, encouraged creativity and new technique.Familiar with art ...
Open Chat in New Window
 him4211 April 22, 2019