Click here to Skip to main content
15,860,972 members
Home / Discussions / Java
   

Java

 
AnswerRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 6:10
mveRichard MacCutchan21-Feb-20 6:10 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169121-Feb-20 7:38
Member 1475169121-Feb-20 7:38 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 22:08
mveRichard MacCutchan21-Feb-20 22:08 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169122-Feb-20 14:38
Member 1475169122-Feb-20 14:38 
QuestionJson Manager Project (Need Critique/Possible Tips) Pin
Member 147385357-Feb-20 16:20
Member 147385357-Feb-20 16:20 
AnswerRe: Json Manager Project (Need Critique/Possible Tips) Pin
Richard MacCutchan7-Feb-20 22:06
mveRichard MacCutchan7-Feb-20 22:06 
GeneralRe: Json Manager Project (Need Critique/Possible Tips) Pin
Member 147385358-Feb-20 3:56
Member 147385358-Feb-20 3:56 
QuestionHow to optimize the time complexity of counting a word Pin
neelayak7-Feb-20 3:28
neelayak7-Feb-20 3:28 
So i am working on a hacker rank question and able to make it work but in certain cases it takes way too much time
Java
<pre>static long repeatedString1(String u, long n) {
		String[] a = u.split("");
		int s = a.length;
		int t = (int) n;
		int r = (t / s) + 1;
		String d = new String(new char[t]).replace("\0", u);
		String[] m = d.split("");
		long p = 0;
		if (s == 1) {
			p = t;
		} else {
			for (int i = 0; i < t; i++) {

				if (m[i].equals("a")) {
					p++;
				}
			}
		}
		return p;
	}


any sugessions how i can make it fast?
The question is i will given a randon string and i have to count no of "a" in the string where "n" is the no of words that will be repeated.https://www.hackerrank.com/challenges/repeated-string/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup[^]
AnswerRe: How to optimize the time complexity of counting a word Pin
Richard MacCutchan7-Feb-20 4:08
mveRichard MacCutchan7-Feb-20 4:08 
GeneralRe: How to optimize the time complexity of counting a word Pin
neelayak7-Feb-20 4:21
neelayak7-Feb-20 4:21 
GeneralRe: How to optimize the time complexity of counting a word Pin
Richard MacCutchan7-Feb-20 4:41
mveRichard MacCutchan7-Feb-20 4:41 
QuestionMessage Closed Pin
20-Jan-20 14:21
bekagaw65320-Jan-20 14:21 
JokeJ Pin
Member 1471420112-Jan-20 9:03
Member 1471420112-Jan-20 9:03 
SuggestionRe: Java task zigzag Pin
Richard MacCutchan12-Jan-20 22:11
mveRichard MacCutchan12-Jan-20 22:11 
AnswerRe: Java task zigzag Pin
ZurdoDev13-Jan-20 1:05
professionalZurdoDev13-Jan-20 1:05 
GeneralRe: Java task zigzag Pin
Richard MacCutchan13-Jan-20 1:33
mveRichard MacCutchan13-Jan-20 1:33 
Questionbus reservation and ticketting system Pin
Member 1469715023-Dec-19 10:20
Member 1469715023-Dec-19 10:20 
AnswerRe: bus reservation and ticketting system Pin
Richard MacCutchan23-Dec-19 21:32
mveRichard MacCutchan23-Dec-19 21:32 
AnswerRe: bus reservation and ticketting system Pin
ZurdoDev13-Jan-20 1:06
professionalZurdoDev13-Jan-20 1:06 
Questionproject on java Pin
Member 1469715023-Dec-19 2:53
Member 1469715023-Dec-19 2:53 
AnswerRe: project on java Pin
Richard MacCutchan23-Dec-19 3:20
mveRichard MacCutchan23-Dec-19 3:20 
QuestionReaderWriter Problem Pin
pembepanter21-Dec-19 10:38
pembepanter21-Dec-19 10:38 
QuestionRe: ReaderWriter Problem Pin
Richard MacCutchan21-Dec-19 21:38
mveRichard MacCutchan21-Dec-19 21:38 
AnswerRe: ReaderWriter Problem Pin
pembepanter21-Dec-19 23:17
pembepanter21-Dec-19 23:17 
GeneralRe: ReaderWriter Problem Pin
phil.o22-Dec-19 3:43
professionalphil.o22-Dec-19 3:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.