Thursday, September 14, 2023

odd string diff

 https://leetcode.com/problems/odd-string-difference/

Beats 19.92%of users with Java
 
class Solution {
public String oddString(String[] words) {
HashMap<String, String> res = new HashMap();
for (String s : words) {
int[] diff2 = new int[words[0].length() - 1];
extracted(s.toCharArray(), diff2);
res.put(Arrays.toString(diff2), res.getOrDefault(Arrays.toString(diff2),"")+ s);
}

return res.values().stream()
.min(Comparator.comparingInt(String::length))
.get();
}

private void extracted(char[] charArray, int[] diff) {
for (int i = 0; i < charArray.length - 1; i++) {
diff[i] = charArray[i + 1] - charArray[i];
}
}
}

 

Wednesday, August 16, 2023

privateGPT

 

finally I have seen https://github.com/imartinez/privateGPT working in my local computer, it is kind of a search engine for documents, I was looking for more conversation level bot  which can learn from the conversation and start answering accordingly, why am I searching for this, it is about our jira`s, there are some repeatitive tickets, if I can teach a bot to realize those and solutions, it can answer users directly or can tell me which doc to answer. not bad privateGPT

Saturday, August 05, 2023

span_id and trace_id

 Spring cloud sleuth architecture and use

http keep alive turn off

if I turn http keep alive off then I get db read tomeouts and db pool size becomes not enough, if I increase the pool size and time outs more then web worker threads becoming non responsive, self note never turn off keep alive for rest clients in spring boot

Saturday, July 08, 2023

Saturday, April 29, 2023

diablo immortal

 strangely I start liking diablo immortal in mobile, and now decided to install in windows :)

odd string diff

 https://leetcode.com/problems/odd-string-difference/ Beats 19.92% of users with Java   class Solution { public String oddString ( S...