/dpt/ - Daily Programming Thread

Old thread: What are you working on, Any Forums?

Attached: 2c7ab5e40c3708702737b154901b8b95.jpg (1000x1000, 201.58K)

Other urls found in this thread:

shadertoy.com/view/tltXDl
github.com/gamedevtech/X11OpenGLWindow
antongerdelan.net/opengl/hellotriangle.html
twitter.com/SFWRedditGifs

vtubers are not programming related

Attached: 347895.jpg (759x1024, 67.85K)

FUCK spammers

>read code
>don't understand it no matter how long i stare at it
😭

can some big brain user make this rect have different edge sizes?
shadertoy.com/view/tltXDl

kanataaa😭gori😭💢

char getMostCommonChar(std::string str){
std::map charMap;
int max=0;
int index=0;
for (int i = 0; i < str.size(); i++){
charMap[str[i]] += 1;
if (charMap[str[i]] > max){
max = charMap[str[i]];
index = i;
}
}
return str[index];
}

Attached: 191.jpg (831x1024, 67.93K)

>char
>int = 0
>doesn't understand hashing
yep
globohomo typing c in c++ again

char getFirstUnrepeated(std::string str){
std::map charMap;
int index=0;
for (int i = str.size()-1; i >= 0; i--){
charMap[str[i]] += 1;
if (charMap[str[i]] == 1){
index=i;
}
}
return str[index];
}

Attached: 85b.png (700x902, 313.99K)

Brainlet take.
You should return a vector of chars in case 2 or more chars have the same occurrence.

>not std::map

nakadashi

#include
#include
#include

int findMissing(std::vector& vec){
int s = vec[0];
for (int i = 1; i < vec.size(); i++){
int n = s+1;
if (vec[i] != n){
return n;
}
s = n;
}
return -1; // no missing numbers
}

int main(){

srand(int(time(NULL)));

std::vector missing;
for (int i = 1; i

Attached: tp.png (500x425, 131.95K)

oh fuck i just reaslized this doesn't work if the missing number is vec[0]

that's literally a boy

user here, i said fuck it and went with opengl with Xlib. this repo was quite useful for filling in the blank since all other guides use glfw
github.com/gamedevtech/X11OpenGLWindow

I got a static triangle going following this guide
antongerdelan.net/opengl/hellotriangle.html

I'll try and figure out what the code is *actually* doing tomorrow. atm it mostly blind copy paste.

nakadashi

>draw a girl
>call it a boy
nah

Higher beaned factories and globalised abstract dependency throws in Java when?

Just failed the shit out of my Amazon phone screen. They asked what LC calls "Meeting Rooms II".

I quickly came up with simply counting each time unit in a large array and finding the max, but they said I arrived at the optimal solution too fast. I thought that was the naive solution.

Then I wrote a really shitty and undoubtedly broken version that did multiple N^2 passes, and was unable to come up with the minheap solution with multiple, heavy hints.

I have 12yoe and have hosted a hundred coding interviews, but still failed hard, kek.

why would you rewrite a broken version that sucks if you've already determined an optimal solution? Did they tell you to after saying you were too quick?? wtf??

That user is a resident shitposter that's always posting schizo LARP.
Just pick the pattern:
Reddit spacing + 4 lines of post + some retarded story about a company trying to sabotage him = schizo user.

Python/C gluecode monkey looking to get into rust, got any decent ressources (yt, git, blogs, books, ...)
pic unrelated

Sent from my samsung - SM-G965F

Attached: EUiJaqeXkAMuGtv.png (500x446, 348.64K)

Yes, they wanted me to find a more naive/basic way of doing it.

I even asked up front whether the numbers were low like in their example, or whether they could be huge, and they said they'd be small and only span a day.

No idea why they didn't just say that yeah, they could be in the billions, so my approach wouldn't be feasible.

No, different user. And I'm a phone poster, therefore reddit spacing.

Any text c# tutorial you guys recommend?