Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Good, good, let the hate flow through you. Your next task is Javascript. Mwhahahaha!
-
@melezorus34 js is still okay. shitty language, but it works and it is upto a developer to make it look shitty or sweet. I have made enough classes in java and kotlin to write beautiful looking JS code that is easy to understand and debug by a new born of 2022 or an oldie from 1970s
-
"finding the Longest Substring Without Repeating Characters"
This seems ambiguous to me. What is definition of "repeating characters"? -
I am proud ofnot solving more than 3 leetcode questions. I have no praise for idiots who are spamming those wuestions while real world don’t need fancy log n algorithms but good ideas.
-
It is doable in O(N) by scanning the string once. And the naive approach likely is the optimal in this case...
But if you don't want to write original code but are more into quickly combining and adapting existing code, that is completely fine too - there are even more jobs that require that mindset. -
when in doubt, just bruteforce the shit out of the problem =D
string input;
List<string> cand = new List<string>();
StringBuilder tmp = new StringBuilder();
int e;
for(int s = 0; s < input.Length; s++){
e = 0;
tmp.Clear();
while(s + len <= input.Length){
if(!Array.Exists(tmp.Chars, chr => chr == input[s + len]) tmp.Append(input[s + len]);
else break;
}
cand.Add(tmp.ToString());
}
// now do the normal "pick index with max length from cand" loop -
@melezorus34 oh
i thought they mean "a sequence containing any char more than once" -
in that case:
string input;
int curLongest, curLongestStart, curLongestEnd, curStart;
char prevChar;
for(int s = 0; s < input.Length; s++){
if(prevChar == input[s]){
if(curLongest < s - 1 - curStart){
curLongest = s - 1 - curStart;
curLongestStart = curStart;
curLongestEnd = s - 1;
}
curStart = s;
prevChar = input[s];
}
i think. -
funny how enter on phone in the app does normal enter
while enter on pc via web does
two enters -
There's some roles where this sort of stuff is still genuinely useful. We use these sorts of questions in hiring because we *need* our devs to be able to think algorithmically and solve tough problems (we have a lot of algorithmic coding.) While I can often spot them a mile off, it's a good way of weeding out the "I can write a RestController in spring and nothing else" ex-consultancy guys.
If it's a job where you're only ever going to be grabbing stuff from a DB, converting to JSON and shoving on a controller though then yeah, pointless. -
Depends on the role. A test engineer probably doesn’t need this.
If you are someone designing logic for a 10M+ user base application, it’s gonna be complicated. It’s only so far one can go in SDE without skills to think algorithmically. -
One of the advantages of working for yourself is not having to waste time studying problems for coding interviews that never actually come up in 95% of real life apps. Big-O can go fuck itself, merge sort can suck by balls. If I need you I'll stack overflow it like everything else
-
@AlmondSauce even then, you are not measuring their algorithmic capability. People who spam those wrbsites will be more successful. Time is short, there is observer pressure etc etc.
-
@aviophile I am measuring it, because I'm interested in their thought process not the outcome. I've taken people who describe decent, logical algorithmic thinking that don't fully complete the task over ones that just parrot off something they know off leetcode and complete it in 2 seconds, but can't explain how or why things work.
-
@melezorus34
it actually might?
pc-put comments instert two <br> per linebreak, android-ones insert one.
might just be an overall webpage difference, someone on linux would need to try and do a linebreak.
however i have seen before occasions when some noob did something like str.Replace(["\n", "\r"], "<br>"); in the naiive assumption he's just "elegantly" covered both linux and windows linebreak cases. -
@Midnight-shcode Normal line breaks worked on the web too til some months ago. But DevRant became like Blizzard. They want everyone to use an app on a tiny screen with a virtual keyboard now. Not sure why.
I use Gentoo btw. -
the dreaded interview came and i crashed it awesomely
first question : something about a binary tree. i think i was doing okay since i was able to get it to at least print the tree. but i wasn't able 1% of the question for 45 mins
next 15 mins he gave another question on handling user logins and logouts. this was an interesting question and i was able to explain an hashmap based approach , but we were short of time so didn't got to code it.
I am guessing that poor fella must have another 3-4 questions for me, but i was so bad at just the 2 of them 😂
Well, guess i ain't leaving my boring job for now 🥲 -
You can find the longest substring without repeating chars by passing over the sequence once, storing the last position you saw a given character in a hashmap and then doing a basic max selection via the difference between the value you're about to write and the current value at the key.
-
If it's ASCII, an array is preferable to a hashmap because it's O(n) and takes up 256 bytes. With a hashmap you'll get about O(n*log(alphabet)) time efficiency.
Related Rants
seeing questions like "finding the Longest Substring Without Repeating Characters" and being unable to find answer for hours make me question myself as a developer and wanna leave the tech world entirely.
And i am the dev who reduced an app size from 64mb to 27mb and rewrote the entire payment stack for a 10million user base company :|
DSA and competitive programming is seriously a bullshit. The world runs on fancy buttons and screens, and grabbing user's attention should be the ultimate goal to get profits. nobody should be learning this aweful stuff anymore. We are storing the open source and stack overflow content below the oceans and glaciars for a fucking reason!, so that our future gen could use those stupid knowlege without recreating the wheel
Why do we have this inferiority complex component in our life? do foot doctors also feel low for not able to understand heart or the working of eyeballs? they all are doctors to us, and all are equally appreciated by peons, HRs, receptionists the owner and even his freaking colleague doctors and seniors!!
But here we will be judged by a stupid "coding interview" for the role of a dev . the interviewer will be laughing at me for not solving a trivial problem with strings, as if I am seeing those bloody strings for the first time. I will be like some peasent to him, asking for more wages while portraying myself as some unqualified filth
FUCK this SHIT
rant
fuck
competitive
dsa
coding