Thread 105718989 - /g/ [Archived: 701 hours ago]

Anonymous
6/27/2025, 7:52:07 AM No.105718989
quiz
quiz
md5: f5743071f605eea476072c81f250a45b🔍
90% of /g/ will get this wrong
Replies: >>105719014 >>105719037 >>105719071 >>105719134 >>105719149 >>105719211 >>105719265 >>105719300 >>105719303 >>105719334 >>105719513 >>105721762 >>105721973 >>105722149 >>105722403 >>105726003 >>105726040 >>105726052
Anonymous
6/27/2025, 7:54:44 AM No.105719014
>>105718989 (OP)
You don't need to reverse a word to check if it's a palindrome what is this brainlet nonsense
Replies: >>105719056 >>105725380
Anonymous
6/27/2025, 7:57:24 AM No.105719037
>>105718989 (OP)
>Wordswordswords
Anonymous
6/27/2025, 7:58:31 AM No.105719047
B. What do I win.
>inb4 tranny porn
Anonymous
6/27/2025, 7:59:54 AM No.105719056
>>105719014
If you don't reverse it how do you know it's a palindrome?
Replies: >>105719099 >>105719123
Anonymous
6/27/2025, 8:01:44 AM No.105719071
>>105718989 (OP)
Pro tip: Always use the option with less nesting.
Replies: >>105719143 >>105726054
Anonymous
6/27/2025, 8:05:20 AM No.105719099
>>105719056
by asking kindly
Anonymous
6/27/2025, 8:08:03 AM No.105719123
>>105719056
i=0
k=s.length
While(i<k)
if(s[i]!=s[k])
return false
i++
k--
return true
Replies: >>105719192
Anonymous
6/27/2025, 8:10:08 AM No.105719134
1726322973585539_thumb.jpg
1726322973585539_thumb.jpg
md5: 8b754eb66a94fcf9908fbb8500a43fa7🔍
>>105718989 (OP)
All 3 solutions are dogshit
You are not hired, you're brown.
Replies: >>105719146 >>105719259 >>105719310
Anonymous
6/27/2025, 8:10:56 AM No.105719143
c823e53b3a1a7b0d36a9
c823e53b3a1a7b0d36a9
md5: 21a00e7457ade6b943868c64488e81b8🔍
>>105719071
>blocks your path
Replies: >>105719161
Anonymous
6/27/2025, 8:11:39 AM No.105719146
>>105719134
I don't think your implicit claim, that only people who come up with the most optimized solution to a problem are the ones who get hired, is true
if that was the case software would be way less shitty than it is now
Replies: >>105719163 >>105719192
Anonymous
6/27/2025, 8:11:56 AM No.105719149
>>105718989 (OP)
because empty array is undefined?
Anonymous
6/27/2025, 8:12:36 AM No.105719156
i can't remember the exact method, but isn't there a way to use modulus to quickly check for a palindrome? it has to do with isolating each character position and then checking for symmetry directly.
Anonymous
6/27/2025, 8:13:15 AM No.105719161
>>105719143
>dart
God no... Please no !!!
Anonymous
6/27/2025, 8:13:28 AM No.105719163
>>105719146
This anon gets it. Fire everyone, and let the AI take over.
Anonymous
6/27/2025, 8:16:14 AM No.105719192
>>105719146
I know as hell I wouldn't let me boss hire you.
You see, a lead dev is always present when hiring someone new to our team, in this case it would be me and sure as hell, I wouldn't accept any of OP's shitty solutions.

I would however accept his (but whit one less variable):>>105719123
Replies: >>105719242 >>105719252
Anonymous
6/27/2025, 8:20:05 AM No.105719211
>>105718989 (OP)
This is part of a recruitment process for a literal pyramid scheme. OP is a retard bragging about being scammed.
Anonymous
6/27/2025, 8:25:04 AM No.105719242
>>105719192
Ah yes, you could do
i=0
While(i<s.length-i)
if(s[i]!=s[s.length-i])
return false
i++
return true
Is that actually better tho? You have to dereference s.length every iteration. I suppose it gets cached tho
Replies: >>105719367 >>105719412 >>105719748
Anonymous
6/27/2025, 8:26:28 AM No.105719252
>>105719192
i = 0;
while (i <= trunc(s.len))
if (s[i] != s[s.len - i - 1])
return false;
i++;
return true;
Replies: >>105719276
Anonymous
6/27/2025, 8:26:45 AM No.105719255
>interview questions for ants

The craziest thing is you can earn way more money in other white collar jobs and the interviews are never this retarded

The whole our company is the most elite dance for us monkey shit gets old real quick after you do enough of them

What you eventually get is that everyone is trying to hide the fact that the job is fuck easy and there’s so many people banging on every door that it’s completely a mistake

That a ton of these people have nothing else they’re good at in life or going on that they enshrine CRUDing as some awesome thing
That other code “smells” or some shit

It’s dickwaving by small people who would get crushed in any real situation
A fucking corner boy fent dealer could steamroll everyone in the room in real life

It’s a job for losers and pussies
Anonymous
6/27/2025, 8:27:13 AM No.105719259
>>105719134
AI doubters are getting so btfo these days it's actually incredible. That is nuts.
Replies: >>105719534
Anonymous
6/27/2025, 8:28:08 AM No.105719265
>>105718989 (OP)
leave it to /g/ neet retards to completely miss the point of this question and jerk themselves off over their "optimized" solutions instead. you would all fail this question miserably.
Replies: >>105719325
Anonymous
6/27/2025, 8:30:44 AM No.105719276
>>105719252
fix:
while (2*i < s.len)
Anonymous
6/27/2025, 8:35:05 AM No.105719296
file
file
md5: a32a9edfea69fe9244e93f0f6e2391ab🔍
but 'racecar' should be True
Replies: >>105719569
Anonymous
6/27/2025, 8:35:59 AM No.105719300
>>105718989 (OP)
In Python this is just
def Check_Palindromes(word_list):
return all(word == word[::-1] for word in word_list)
Anonymous
6/27/2025, 8:36:18 AM No.105719303
>>105718989 (OP)
Can confirm
>t. Got it wrong 9 times out of 10
Anonymous
6/27/2025, 8:37:48 AM No.105719310
df408e20-1287-4c08-9aba-fc8b3fabf226_0_thumb.jpg
df408e20-1287-4c08-9aba-fc8b3fabf226_0_thumb.jpg
md5: 48c1d42f222aaf0b11fb9b4d194b705d🔍
>>105719134
Replies: >>105719324
Anonymous
6/27/2025, 8:41:11 AM No.105719324
>>105719310
AI is getting weird
Replies: >>105719472
Anonymous
6/27/2025, 8:41:34 AM No.105719325
>>105719265
I mean, most well-equipped high-level languages will have a reverse() method and an all(condition) method. The task is trivial.
Low-level languages will require manual implementation just like what the neets here are doing.
Replies: >>105719422
Anonymous
6/27/2025, 8:43:40 AM No.105719334
>>105718989 (OP)
Option C is the longest, so it's obviously the most correct.
Anonymous
6/27/2025, 8:49:29 AM No.105719367
>>105719242
>it gets cached ?
Yes, either runtime optimizer (in case of jit) or the compiler will sort that out.
Anonymous
6/27/2025, 8:58:15 AM No.105719412
>>105719242
>You have to dereference s.length every iteration
If you're that concerned about it, you could store it in a stack variable.
Anonymous
6/27/2025, 9:00:00 AM No.105719422
>>105719325
The point is that you should be able to recognize that only one of them works with any number of words while the other two only work for exactly three.
Replies: >>105719457
Anonymous
6/27/2025, 9:06:28 AM No.105719457
>>105719422
Since when "best practices" means "find the one option that actually functions"? Besides, the only correct one has a bad of cleancodeitis.
Replies: >>105719463 >>105719487
Anonymous
6/27/2025, 9:07:29 AM No.105719463
>>105719457
*case
Anonymous
6/27/2025, 9:08:27 AM No.105719472
>>105719324
always has been
>deep dream
Anonymous
6/27/2025, 9:11:15 AM No.105719487
>>105719457
>Since when "best practices" means "find the one option that actually functions"?
It's a best practice to write code that works.
Anonymous
6/27/2025, 9:15:08 AM No.105719513
>>105718989 (OP)
Solution 4: don't ask AI and code it yourself.
Anonymous
6/27/2025, 9:17:04 AM No.105719534
>>105719259
Soon, the entire movie industry will shift to Ai aided content
Replies: >>105719550
Anonymous
6/27/2025, 9:19:14 AM No.105719550
>>105719534
That would probably improve the quality over what it shits out now.
Anonymous
6/27/2025, 9:22:34 AM No.105719569
>>105719296
You've failed the interview due to being illiterate. Congratz.
Replies: >>105719589
Anonymous
6/27/2025, 9:25:34 AM No.105719589
>>105719569
OP was right, 90% is wrong.
Anonymous
6/27/2025, 9:51:01 AM No.105719748
>>105719242
It depends on what exactly your code looks like. If you're using strlen() on C-style char* strings it actually might fail to cache but not in this example since you're just doing pure stuff locally. In any case, caching strlen() into a temp variable is free since it's more or less the same as you directly telling the compiler to cache it.
Anonymous
6/27/2025, 2:38:44 PM No.105721762
>>105718989 (OP)
>reversing a string to check for palindromes
An Indian (AI) wrote this.
Anonymous
6/27/2025, 3:02:09 PM No.105721903
Option B seems perfectly fine to me. Yeah, checking the existing string for palindromitude in-place character by character is faster, but this version is more obvious, which is usually more important if not specified otherwise.
Anonymous
6/27/2025, 3:11:29 PM No.105721973
>>105718989 (OP)
>Pseudocode
There is no correct answer. You can't evaluate the efficacy of something that doesn't function.
Anonymous
6/27/2025, 3:27:21 PM No.105722085
B is clearly the best answer of the 3, the others are pajeet i fear for loops level of shit

Not that the best of the three is the most optimal
Anonymous
6/27/2025, 3:34:10 PM No.105722149
>>105718989 (OP)
Get what wrong? There is no question, just an observation of how "AI" handles a programming request
Replies: >>105722423
Anonymous
6/27/2025, 4:08:42 PM No.105722403
>>105718989 (OP)
>hur dur let's put the helper functions at the top
no fuck you every ide worth their salt can quickly jump between call site and declaration. all of these solutions belong in the trash
Anonymous
6/27/2025, 4:10:46 PM No.105722423
>>105722149
have you ever been to a school?
Anonymous
6/27/2025, 8:41:57 PM No.105725380
>>105719014
This is the only valid answer.
Anonymous
6/27/2025, 9:19:05 PM No.105725812
def are_all_palindromic(arr):
def reverse_str(s):
if s == "":
return ""
else:
return reverse_str(s[1:]) + s[0]

def is_palindrome(el):
s = str(el) # Convert to string
n = len(s) # Number of characters

# Check for edge cases
if n == 0:
return True # Empty string
elif n == 1:
return True # Single character
else:
# Check for base case
first_last_match = (s[0] == s[-1])
inner_check = is_palindrome(s[1:-1]) if n > 2 else True
reversed_full = reverse_str(s)
full_match = (s == reversed_full)

midpoint = n // 2
first_half = s[:midpoint]
second_half = s[n - midpoint:]
reversed_second = reverse_str(second_half)
half_match = (first_half == reversed_second)

# Return final result
return first_last_match and inner_check and full_match and half_match

i = 0
# Check if all elements are palindromic
result = True
# Copy array
arr_copy = arr[:]

# Iterate through array
while i < len(arr_copy):
current = arr_copy[i]

check1 = is_palindrome(current)
check2 = (str(current) == str(current)[::-1])

if check1 == check2:
result = result and check1
else:
s = str(current)
mid = len(s) // 2
valid = True
for j in range(mid + 1):
# Check if first half is equal to second half
if j < len(s) and (len(s) - 1 - j) >= 0:
# Check if characters are equal
if s[j] != s[len(s) - 1 - j]:
# Set valid to false
valid = False
result = result and valid

i += 1

return result
Anonymous
6/27/2025, 9:37:53 PM No.105726003
>>105718989 (OP)
Ok. What's the question?
Anonymous
6/27/2025, 9:41:53 PM No.105726040
>>105718989 (OP)
all fail. the instruction was to return True or False, not true or false
Anonymous
6/27/2025, 9:42:57 PM No.105726052
1556514091571
1556514091571
md5: 764addcb18c5c96433d31252ab35984b🔍
>>105718989 (OP)
sigh.
Anonymous
6/27/2025, 9:43:07 PM No.105726054
>>105719071
This is the best and concise answer. Nesting is a nightmare to deal with.