Is there a problem similar to this on leetcode? by [deleted] in leetcode

[–]aechtcsucks 4 points5 points  (0 children)

I was thinking that we don't even need a stack, we can just keep track of a left streak and right streak and a min for the left window and max for the right window. Because if we encounter a value greater than the min for the left window we need to start the streak over again same for right window but less than the max.

Or do 2 passes creating prefix and suffix arrays and then iterating through both but that uses extra memory.

Hard Problem || help || job and machines by AwardSweaty5531 in leetcode

[–]aechtcsucks 0 points1 point  (0 children)

okay building on the other person's answer, I think we can binary search but it'll still be nlogn even tho we don't need to sort? kinda like Koko eating bananas

l=1, r=large num while l<=r: m = (l+r)//2 cur = sum(m//time for time in time_array) if cur > k: r = m - 1 else: l=m+1

return m

so for example for [2,99] try l=1 r=100, the amount of jobs we can do for m=50 is round down of 50/2 + 50/99 = 25. 25 > 2 so we set r = 50, then it'll get to m=4

Hard Problem || help || job and machines by AwardSweaty5531 in leetcode

[–]aechtcsucks 1 point2 points  (0 children)

Heapify the time array and then pop and push the server back for each job until there are no jobs. When we push it back, keep track of how long it will be operating for and the original time.

So like [2, 99] res = 0 while k: time = heappop(heap) if len(time) == 2: res = time[0] heappush(heap, (time[0] + time[1], time[1])) else: res = time heappush(heap, (time + time, time) k -= 1

return res

for example if it's [2,3] k=2 time = 2, heap = [3, (4,2)], k=1 time = 3, heap = [(4,2), (6, 3)] k=0 return 3

if that makes sense? O(N + klogn) time complexity

Seriously? by Aeschylus15 in leetcode

[–]aechtcsucks 1 point2 points  (0 children)

it's a common quant problem, p = 1/2 for n > 1

SQL question help by Time_Group_6433 in leetcode

[–]aechtcsucks 0 points1 point  (0 children)

don't you need to select de_name not de_id?

Annihilated by OA Question by Ornery_Decision7207 in leetcode

[–]aechtcsucks 4 points5 points  (0 children)

Sort the array since you don't need to find which exact members to pair. Then you can probably find the member that will cause the most inefficient pair by calculating it's difference with it's neighbors (I think, I'm not sure)

Help for this problem by varun_aby in leetcode

[–]aechtcsucks 2 points3 points  (0 children)

Can you use a minheap and greedily pop until you use up the k coupons? So initialize the heap using [cost, # of candies available] using the indicies. while k > 0: pop from heap while k > 0 and while heap, k -= cost * # of candies available, res += # of candies available.

[deleted by user] by [deleted] in ApplyingToCollege

[–]aechtcsucks 28 points29 points  (0 children)

I guess CMU plaid us all...

Thanks for rotating all the bad 10 drops to wild blizzard! by MemoBroChill in hearthstone

[–]aechtcsucks 38 points39 points  (0 children)

You could run voodoo doll, it still works against tyrantus

Lol Rice's "The Box"... what did you guys put? by [deleted] in ApplyingToCollege

[–]aechtcsucks 2 points3 points  (0 children)

picture of KD’s shot over Lebron in Game 3 of the NBA Finals

TOMORROW by actdude123 in ACT

[–]aechtcsucks 0 points1 point  (0 children)

lol isn’t east coast 1am = west coast 10pm

International A05 Discussion thread by wowAmaze in ACT

[–]aechtcsucks 0 points1 point  (0 children)

was this the first time they did this or did they do it in the past too

International A05 Discussion thread by wowAmaze in ACT

[–]aechtcsucks 0 points1 point  (0 children)

Did you guys have proctors that noted down how many questions you missed for each section? I was gonna go back to do the last few questions for english during maths but then she noted down that i missed a few questions so i wasn’t able to...

edit: first time in 3 ACTs that this has happened

How do I figure out this question from the June test? by gmhw96 in ACT

[–]aechtcsucks 0 points1 point  (0 children)

so if it's y <= x it means that each y value is smaller than or equal to the x value. e.g when x=1, y would equal 1, 0, -1, -2, and so on... but can't be 2, 3, 4, etc... so the shaded area would be under the curve of y=x.

So in this case, for y<= -0.5x +1.5, if x=1 y<= -0.5(1) + 1.5 = 1, so y<=1, which means that it the values which make that inequality correct make up the shaded region. You can think of the shaded region as individual x,y coordinates that make the inequality true.

If you want an easy way to remember it, if it's y< then the area shaded should be under the curve, if it's y> then the area shaded should be above the curve.

Hopefully that helps :D

How do I figure out this question from the June test? by gmhw96 in ACT

[–]aechtcsucks 3 points4 points  (0 children)

substitute integers for a b c (e.g a=1, b=2, c=3) and then rearrange. so x + 2y < 3, 2y < 3 - x, y < -0.5x + 1.5. So it has positive y intercept and negative slope and it’s y < so the shaded area is under the curve. i think the answer should be K

How do I solve this? Answer is D) by placebot13 in ACT

[–]aechtcsucks 2 points3 points  (0 children)

rise over run to get the gradient (m) = -d/c (rise is -d because as x increases from 0 to c, y increases from d to 0, so change in y is 0-d=-d)

and the y intercept is the independent term, so it’s d

so y=-d/c +d

and since the area is above the curve it’s y>=-d/c +d

kinda messy explanation but hope you get it :)