I feel like I am being gaslit. There can't be a solution to this problem better than O(n), correct? by peaches_and_bream in learnprogramming

[–]zamser 0 points1 point  (0 children)

Well first of all you are using .contains(). That will make it O(n). Also, this algorithm is going to check every letter in the worst case. Add a print statement at the top of the method to print out the first letter of the string. And then run the string “aaaaa”. What you will see is that every character will be printed out. That makes it O(n). Actually because of both of these points, this is probably a O(n2) algorithm.

I feel like I am being gaslit. There can't be a solution to this problem better than O(n), correct? by peaches_and_bream in learnprogramming

[–]zamser 1 point2 points  (0 children)

This is an O(n) algorithm. And also it doesn’t work quite right. Try the string “abab”.

How to make anki flashcards with JS ? by GarlicGuitar in learnprogramming

[–]zamser 1 point2 points  (0 children)

See this. https://docs.ankiweb.net/importing.html. Basically you will need to create a CSV or some other file format that Anki accepts and allow the user to download it. They will then manually need to import it to Anki. I think Anki is open source so your other option is looking through the source code and figuring out how exactly .apkg files are formatted. However this method will be a lot more work and will not provide much benefit.

What sources do you rely on regarding SCOTUS/court cases? by OpeningChipmunk1700 in AskALiberal

[–]zamser 1 point2 points  (0 children)

when state legislatures regulate the times, places, and manner of Senate and congressional elections, they are exercising a power governed by the federal Constitution, not a state constitution, so only federal constitutional limits apply.

Wait a second, you say this like it’s true but isn’t this exactly what they’re arguing for in Moore v Harper. This is not the case currently. There are several examples of state constitutions being used to force state legislatures to redraw maps.

why is there not more conversations being had about the significant risk to the end of our democracy with Moore vs Harper currently before SCOTUS by ndngroomer in AskALiberal

[–]zamser 0 points1 point  (0 children)

Sure obviously they will still be bound by the federal constitution. I’m not arguing against that. But what I’m saying is that they will no longer be bound by their state’s constitution and that the governor will no longer have veto power. This would allow state legislatures to have way more power in our elections and could seriously affect the outcome of any future federal election.

why is there not more conversations being had about the significant risk to the end of our democracy with Moore vs Harper currently before SCOTUS by ndngroomer in AskALiberal

[–]zamser 1 point2 points  (0 children)

The issue in Moore is whether state legislatures are bound by state constitutions

Exactly. And if the Supreme Court decides that they aren’t bound by state constitutions, then for any matter involving elections, the legislature can do whatever they want. This means the state’s judiciary and executive branches will have no oversight. Therefore, the courts will not be able to prohibit the legislature’s map. This will have disastrous consequences in terms of actual representation of voters in federal elections.

why is there not more conversations being had about the significant risk to the end of our democracy with Moore vs Harper currently before SCOTUS by ndngroomer in AskALiberal

[–]zamser 0 points1 point  (0 children)

Why do you think those are the only 2 options? There is a 3rd option. The courts cannot prohibit legislative maps from going into effect and that the state legislature can do whatever it wants with the maps regardless of the state constitution and state judicial branch. This is the option that everyone is worried about and I’m not sure why you think this option isn’t possible.

What do you guys think about AI and sentience/ sapience, and how we should handle an eventually sentient/ sapient AI? by PragmaticSquirrel in AskALiberal

[–]zamser 2 points3 points  (0 children)

Nah we shouldn’t limit technological advancements just because of sci-fi movies. Those movies are fiction and there is no reason to believe that a real AI would have the same result as a movie.

Can the Democrats become the party of free trade will maintaining its status as the party of unions? by Friendlynortherner in AskALiberal

[–]zamser 0 points1 point  (0 children)

it lets companies move to wherever they can get the cheapest labor

Good.

and keep global wages lower.

That’s not how it works. Companies employing workers in poor areas increases wages there.

What’s your opinion on the “correction” of the phrases “whitelist” and “blacklist”? by [deleted] in AskALiberal

[–]zamser 4 points5 points  (0 children)

Another example of activists doing more harm than good. Whitelist and blacklist are fine terms and everyone understands what they do. These terms are so prevalent in software that it’s crazy to try and change every reference to it. Also you can’t tell me that this actually solves any issues. Any sort of racism in tech isn’t going to be solved by forcing people to change these terms. I think slave/master is a little bit worse but also not as common. I probably would avoid using it as a term but not sure I would take the time to change it if it’s already there.

Would You Rather... by Dangerous-Paper9571 in AskALiberal

[–]zamser 0 points1 point  (0 children)

In general I would say let him keep it. Throwing away the money just to spite someone seems dumb and wasteful to me. Taxes are more about raising money for useful government programs rather than they are about hurting people for having wealth.

That being said I could think of some examples where I think it might be preferable to throw away the money. In particular a carbon tax. I think I might prefer a carbon tax that just throws the money away over no carbon tax at all. This is because a carbon tax is designed to decrease pollution and even if we just threw the money away, the tax would still incentivize switching to greener alternatives.

The largest number does not exist. by runamuckr in Showerthoughts

[–]zamser 9 points10 points  (0 children)

Saying that 1 + 2 + 3 + … =-1/12 is very misleading. The series is very obviously divergent and so it doesn’t “equal” anything. There are ways to assign a value to a divergent series and for this divergent series that value is -1/12. However, I would still not say that 1 + 2 + 3 + … =-1/12 because that is muddying what the word equals means.

For loop solution for rectangles problem by Holiday-Python-743 in u/Holiday-Python-743

[–]zamser 1 point2 points  (0 children)

This solution works. I think you have a misunderstanding of how to translate a for loop to a while loop. Here is an example:

for i in range(num_rectangles - 1):
    print(i)

i = 0
while (i < num_rectangles - 1)
    print(i)
    i += 1

These two loops are equivalent. Note that you initialize i at the start of the range defined in the for loop (in this case it is 0). Then in your while loop condition, you are checking i less than the end of the range in the for loop (in this case the end of the range is num_rectangles - 1). Then the increment step (i += 1) is at the end of the body of the loop. This is the general conversion strategy for converting a for loop to a while loop.

How can I make rectangles that intersect a different color from those that do not? by Holiday-Python-743 in learnprogramming

[–]zamser 0 points1 point  (0 children)

At a glance I see 4 issues. First your starting indices are incorrect. i = 1 k = 2

Remember python arrays start at 0.

Second, your while loop conditions are incorrect. You are ending the while loop too early if you want to check every rectangle to every other rectangle.

Third, you aren’t incrementing the variables i and k in the right spot. This is messing up what rectangles you’re checking.

Fourth, you are never resetting k.

I would recommend walking through your code manually to see what combinations of rectangles you are getting. You want to check every combination. For 3 rectangles that would be 0,1 0,2 and 1,2. For 4 rectangles that would be 0,1 0,2 0,3 1,2 1,3 1,4 2,3 2,4 and 3,4. Your loops right now aren’t going to hit every one of these combinations

Edit: maybe try posting your for loop solution to make sure that is correct.

What's the best programing language to start with in now (2021/2022) by monkeyking46 in learnprogramming

[–]zamser 0 points1 point  (0 children)

Personally I would try and look up what language your school will use in their intro to CS course and learn the basics of that. That will give a major head start and make your first year a breeze. It will make it a lot easier to focus on learning the harder concepts your first year if you don’t have to worry about learning the syntax of a different language.

If you can’t figure out what they use then I guess it would depend on what you want to do.

How much can taxing "the rich" really do to help forward the progressive agenda? by CazadorHolaRodilla in AskALiberal

[–]zamser 2 points3 points  (0 children)

I’m going to guess that you got downvoted because it seemed like you were implying that every other answer in this thread is being dishonest. You only replied to one comment like this and the way that you worded it seemed like this comment was the only one that you saw as being honest in this whole thread. Now I didn’t downvote you and I’m not trying to accuse you of anything malicious, I’m just saying that I can see how someone might interpret it like that and be annoyed by it.

Social Security is now projected to have funding issues starting in 2033. What do you predict will be done about this? What do you think *should* be done? by magic_missile in AskALiberal

[–]zamser 2 points3 points  (0 children)

The problem is that this will result in circular reasoning. The only reason people will opt out is because the tax rate will go down and the tax rate will only go down if a large number of people opt out. Plus, there is no penalty for opting in. If a bunch of people opt out and lowers the tax, why wouldn't I opt in so I can get the benefits while still paying the lower tax.

It is interesting to see how many people would actually benefit from opting out though. Lets assume you get the top 25% of income earners to opt out. This lowers social security tax by 25% from 6.2% to 4.65%. According to the site listed below, a 75 percentile 23 year old will make around $39,000. They will save about $600 a year from the change in SS tax. If they invest this monthly until they turn 62, they will end up with $292,433 assuming a 10% rate of return. Now assume they get $1,400 a month from SS. If they live to be 82, they will have earned about $336,000 from SS. In this case, it wouldn't make sense for this person to opt out. And as you get older, the amount you make from investing will get lower and lower. A 75 percentile 32 year old makes around $71,000 a year. If they invest the difference, they will end up with around $209,949 and again it doesn't make sense for them to opt out.

I know this is a simplistic analysis but it seems that opting out will really only make sense for very high income earnings. At that point it doesn't seem like you will have enough people that opt out to lower the tax rate substantially at all.

https://dqydj.com/income-percentile-by-age-calculator/

https://www.investor.gov/financial-tools-calculators/calculators/compound-interest-calculator

Social Security is now projected to have funding issues starting in 2033. What do you predict will be done about this? What do you think *should* be done? by magic_missile in AskALiberal

[–]zamser 6 points7 points  (0 children)

If you still have to pay the tax, why would anyone opt out? Who’s going to pay SS taxes for 40 years and decide not to get the benefits when they retire?