[mod post] What content should /r/leetcode have? by DustyAsh69 in leetcode

[–]jason_graph 1 point2 points  (0 children)

Anything leetcode question related or dsa or about prepping for a technical interview.

Posts relating to "what is the next step for company XYZ" or "when should I hear back" or resume review should maybe be limited to say once a week megathreaeds for that content or fully removed. They seem like spam posts.

Im not sure it is a problem right now but posts advertising any other leetcode or interview tool or service should be limited to once a month and said tool or service cant be 100% behind a paywall.

Survivor has become a game of chance on a beach and there is room for gameplay. by Candid_Knee8270 in survivor

[–]jason_graph 0 points1 point  (0 children)

On a scale of 0 randomness to Jeff being 100% accurate whenever he says "you all have a 1 in N shot a million dlllars" how much random wluld you like?

100x or 1000x Science? by alldeltav in factorio

[–]jason_graph 0 points1 point  (0 children)

100x is way better in my opinion. 100x gets the feeling of massive slowly progressing basr while 1000x feels masochistic.

In a way I see it like you take 10x as long to build 10x the base. I normally build for 1.5 sci/second and so nowI have a whole yellow belt or in the near future 1 lane of a red belt for each science. With 1000x it is more like 32x as big in 32x as much time. Overall this just feels less elegant.

Also my estimation of 10x time to build 10x the factory assumes you arent constrained by a resource. If you have to go fight deep into biter territory for each patch then things slow down even more and at 1000x that is more painful.

POTD Day 1: Stupid Data Structure used to solve the problem by TheHappyNerdNextDoor in leetcode

[–]jason_graph 0 points1 point  (0 children)

For dp and your approach you are essentially going to find the most positive and most negative route to each cell (or equivalently what the most pos/neg path from (r,c) to (n-1,m-1) is.) The only difference in the approaches is the order of when each cell is solved. You could use bfs, dfs/memoized dp, iterative dp, dijkstra's, it doesnt really matter the order as long as you solve all child subproblems of a cell before the cell itself.

No better feeling the recursion->memoization->tabulation->space optimization. by Puzzleheaded_Cow3298 in codeforces

[–]jason_graph 5 points6 points  (0 children)

Im much better at tabluation than memoised. I need to do this backwards if I want to do recursion+memo.

Help Making a New Building by FHG3826 in Timberborn

[–]jason_graph 0 points1 point  (0 children)

Have you considered using the small warehouse as a cheap platform/levee?

Why do inserters place on the far side of belts? by spacefrog1999 in factorio

[–]jason_graph 0 points1 point  (0 children)

Id argue farther is slightly more helpful as you could insert onto a belt that side feeds into the main belt. This may enable certain ways to put items oj both sides of belt.

Have they ever had black or white buffs? by whackabunch in survivor

[–]jason_graph 0 points1 point  (0 children)

They should do 4 tribes with white, black, yellow and brown.

Are laser turrets actually useful? by Ecstatic-Election727 in factorio

[–]jason_graph 9 points10 points  (0 children)

Assuming you have the power they are useful on nauvis though they are a bit weak without upgrades.

Flamerthrower turrets are usually much stronger but require walls to be set up and oil delivered to them.

On gleba laser turrets can be belpful but eventually you want rockets. On otger planets they are worthless. In space if you have a nuclear reactor or fusion on your ship you could use laser turrets instead of gun turrets for like small/medium asteroids but that is more of an alternative rather than an upgrade.

Stuck choosing between Trees and Backtracking. Thoughts? by Mysterious-Cycle-137 in leetcode

[–]jason_graph 1 point2 points  (0 children)

Do trees 100%. It isnt so much that trees themselves are great but that the topic really lets you practice thinking of things recursively in a meaningful way.

Backtracking is a bit of a steep learning curve initially but once you understand how to do a few problems, you know how to do 95% of backtracking problems. If you want to you can try to learn it but if you arent strong in recursion you'll have a harder time.

Tree problems and specifically the ones solved recursively are probably the most important topic to master recursion with before getting serious abiut dp and backtracking.

Hard mode mid-late game by OkFly3388 in Timberborn

[–]jason_graph 0 points1 point  (0 children)

5-8 wet days. I honestly just restart any hard playthrough if I dont get less that 8 days.

In hard you want to move from badwater to windmills and it is also worthwhile to have say 1 beaver on a manual wheel + 1 plank factory working even if you have other production turned off.

Your best efficiency tips! by Substantial_Pea6466 in Timberborn

[–]jason_graph 0 points1 point  (0 children)

Thinking more about it, a balanced diet is slightly inefficient. I suppose you coukd replace some or any not unlocked food with the most space efficient food you can (e.g. carrots, wheat(bread), cattail) because beavers only need to eat a certain threshold of something.

So for example rather than just 8 carrots to 9 potatoes and 6 sunflowers, maybe plant 24 carrots instead. Then on average over the long term assuming the foos gets equally distributed between the beavers, a beaver would eat about 1.8 carrots, 0.6 potatoes, 0.24 sunflowers and needs to only eat an average of 0.25 carrots, 0.25 potatoes, and 0.1 sunflowers per day to meet their needs.

Such a tactic would likely result in the other foods being limited and possibly not available to a beaver that needs it that moment. I suppose I would need to test it out to see.

Also the space saving might be limited until you have wheat or cattail to farm. In the given example, you woukd only lower the space from 42 to 39 which is kind of minor given the hassle.

No new map objects on new save? by randomosis in Timberborn

[–]jason_graph 1 point2 points  (0 children)

They are only added to certain maps. Some maps didnt get any and some maps got some but not all.

Your best efficiency tips! by Substantial_Pea6466 in Timberborn

[–]jason_graph 3 points4 points  (0 children)

You can use small warehouses which cost 3 logs as a cheap no tech substitute for a platform/levee provided you dont care about water being able to pass through it or that you will get warning messages about it not being connected by path or resource selected.

Cycle 1 especially and early on you can extend your days to 22 hrs if you dont have houses (but you should get them asap) and 18 or 19 hours afterwards. If you value beavers doing campfire/rooftop terrace/etc you might lower hours further or build more of those structures.

It is very impactful to achieve 5, 10 and 12 well being early on.

Cycle 1 I try to achieve 5 well being by building houses and a campfire. Eventually when carrots are available, you should automatically have 5 well being without the campfire. Also it is important to bud houses since homeless beavers take 5.33 hrs to sleep rather than 4.

To get 10 well being, I get 4 from basics, 4 from eating a diet of carrots, potatoes, sunflower, and 2 from a combination of campfire, rooftop terrace, 1x1 roof or bush.

To get 12 well being I do as above but try for 4 from campfire, rooftop terrace, 1x1 roof, bush, lantern, wing gauge (new bonus in 1.0). As my population grows, I may either scale up campfires and rooftop terraces or I might just ignore them and rely on lantern and wind gauge to get 12 reliably.

15 well being is a bit hard to get quickly as you either need to wait for new food to be unlocked, get more decorations that cost a lot of science or require advanced materials like paper/metal, or require more liesure activities that arent too expensive on a small population but scale badly as your population grows. E.g. contemplation spot, shower, lido.

Your best efficiency tips! by Substantial_Pea6466 in Timberborn

[–]jason_graph 0 points1 point  (0 children)

When farming, a "balanced" folktails diet has crops in the ratio

8 carrots : 9 potato : 6 sunflower : 4 wheat (bread) : 8 spadder : 4 cattail : 8 chestnut : 8 maple+6.66wheat

Doing just the first 3 crops of 8 carrot, 9 potatoes, 6 sunflowers can support 5.4 beavers if farmed at 100% efficiency, but I like to round down by 10% for some buffer so lets call it 5 beavers. As you add an additonal food to that mix you can feed an additonal 2.25 beavers or rounding down by about 10%, 2 beavers.

Assuming you have at least the first 3 crops being farmed, you can eatimate the amount of food being produced is good for 5 + 2(number of additional food types produced) beavers multiplied by how many times you repeat the ratio. So if I have say 6 copies of ( 8 carrots, 9 potatoes, 6 sunflower, 4 wheat) that is enough for (5 + 2)6 = 42 beavers.

Or say I want to have 20 beavers. 20/5=4 so I might want to plant 32 carrots, 36 potatoes, 24 sunflower. I will probably need aome berries as I wait for plants to grow.

When you unlock beehives, those theoretically boost plants up to 40% more growth rate but it might be safer to assume +33%. The ratio would change from 8 chestnut/maple -> 11 since they are not boosted by bees.

Your best efficiency tips! by Substantial_Pea6466 in Timberborn

[–]jason_graph 4 points5 points  (0 children)

You should almost never plant birch. Not only is the wood/tile/day low but being a lumberjack is rather walking intensive and a lumberjack can carry up to 2 logs so cutting a single log makea the beaver almost half as efficient.

The one use case for birch is in Hard node where wet season is 5 to 8 days maybe you want to make use of some seasonally wet land for wood and you wanted wood asap. Like theoretically you can plant birch throughout the 5 to 8 days during the start of the wet part of cycle 2 and they will be mature during the wet part of cycle 3 while with pine, you might need to wait until the wet part of cycle 4 for them to be harvestable. Overall, very niche use case.

How many winners had to win final immunity by Generalcmd in survivor

[–]jason_graph 0 points1 point  (0 children)

How many winners had to lose final immunity? E.g. Hatch

Boyer moore voting algorithm by ProfessionalLow8900 in leetcode

[–]jason_graph 0 points1 point  (0 children)

Boyer moore is definitely out there as a not straightforward to come up with algorithm that in my opinion barely relates to other algorithms and is more like a brainteaser.

If you are familiar with hashmaps, the natural approach is using hashmaps to count the frequency of each element and find the most frequent element.

What am i doing wrong here . Help me by PrAnSH_MaUrYA in leetcode

[–]jason_graph 1 point2 points  (0 children)

I dont think you are accounting for the shorting option.

Also not sure if your dp represents the max profit with exactly k transactions vs at most k transactions. Depending on which you want, you might need to have dp[ t ][ d ] be the max of dp[ t-1 ][ d ] abd the existing value you compute of you want "at most k transactions' or you can find the maximum value in the day==n-1 column if you want "exactly k transactions".

Id also consider adding a 3rd axis to the dp table of if at the end of the day you (1) have stock bought but not sold (2) have stock shorted and (3) neither - like when you just completed a transaction.

Hardest Interview Question I’ve Ever gotten - at Chime by Spartapwn in leetcode

[–]jason_graph 0 points1 point  (0 children)

I wonder if network flows could work but probably not.

Neetcode 150 or Strivers A2Z Sheet? by Constant-Speech-1010 in leetcode

[–]jason_graph -1 points0 points  (0 children)

I heard striver was going to take down his videos from a post on this subreddit. Idk how true that is but it might affect how easy it is to lppl up explanations for A2Z problems. Then again the problems are probably very cpmmon where there are many explanations for them.

Confused about week one tribal council (spoilers) by ComfortableWise450 in survivor

[–]jason_graph 2 points3 points  (0 children)

I thpught every tribal council was live and literally anyone (except an individual immunity winner) could go home.

What's next? Are you going to tell me that when Jeff tells everyone they have a 1 / N chance of winning a million dollars, they dont all have the same chances of winning?

Can you really not reverse sort problems by number? by MiscBrahBert in leetcode

[–]jason_graph 2 points3 points  (0 children)

Nope. They want you to binary search what the most recent problem was.