Fork me on GitHub
#off-topic
<
2019-10-11
>
solf02:10:47

Yesterday I did a simple problem: you were given a grid in input, count the number of battleships in it. https://leetcode.com/problems/battleships-in-a-board/ The problem was on the additional challenge: > Could you do it in one-pass, using only O(1) extra memory and without modifying the value of the board? We had a debate over what one-pass means. For me it means accessing the value of each cell only once. For other people, looping through the grid once but for each cell potentially checking it's neighbors was single-pass.

solf02:10:17

I was fairly certain my definition was the good one, but as I can't find any solution that satisfies it... well, maybe I was wrong. It just seems that checking the neighbourgs for each cell makes the algorithm too simple for an "additional challenge".

roklenarcic07:10:02

I've bought a new iPhone and I'm struggling here to copy my Google Authenticator app codes to a new phone... seems like there's no way to copy the secrets to the new phone

henrik07:10:51

It’s a bit too late now, but get yourself a password manager if you don’t already have one and store the authenticator seeds with the logins to the sites in question. Make damn sure that the password manager is secure.

henrik07:10:33

The seed can be added to multiple authenticators.

roklenarcic07:10:44

yeah, I'm looking for an app like this, I generally use system keychain to store passwords

roklenarcic07:10:30

There's a bunch of other authenticator apps in the Apple App store, I have hard time choosing, does anyone have any recommendations? I would like to be able to have same codes in multiple devices, which seems to be a no-no with Google Authenticator app

Dmytro Bunin08:10:30

Authy is an option

roklenarcic09:10:28

I'll try that, thanks

roklenarcic09:10:17

Hm authy doesn't seem to be able to move codes between devices without using their cloud backup service

roklenarcic09:10:07

Found an app that does what I want: 2FAS Auth

lread15:10:52

I've been very much enjoying my clojure journey which is mostly made up of happy distractions. Ironically my current distraction is charting my distractions. Maybe you'll find it amusing too: https://cdn.jsdelivr.net/gh/lread/lee-clojure-journey@5c3ef6986ef260050218361fb5cec800a91927fd/lee-clojure-journey.svg

😀 16
🌀 8
👍 4
sogaiu21:10:02

fantastic! thanks for sharing 🙂

lread02:10:15

hey thanks @UG1C3AD5Z, glad you like it!

jaihindhreddy07:10:41

It links to itself. Very meta-circular. Loved it 💯

lread12:10:48

thanks, I thought that was fun too 🙂

Chase16:10:01

That was fun! I like this graphing tool. Thanks for sharing.

kenj16:10:05

what graphing tool was used to make that?

lread16:10:55

a recent discovery for me: http://draw.io

Chase16:10:54

I was wondering the same and then saw it had it's own distraction branch. haha

kenj16:10:15

that's a really cool tool, just sitting there for free...

lread16:10:53

I know right? I was an old OmniGraffle user and find http://draw.io to be a great free alternative!

jaihindhreddy07:10:26

Given http://draw.io, is Omnigraffle worth the money? I know it's a bit subjective but, wanna know your thoughts...

borkdude08:10:49

I think it's valuable to have an open source / free alternative as it's more open to contributors

borkdude08:10:55

when you have diagrams in your OSS project

lread12:10:41

yes, exactly what @U04V15CAJ said.

💯 4
lread12:10:53

That said, my paid copy of OmniGraffle is so out of date it does not work anymore. I’m not going to pay to update it unless I’m on a project that both prefers OmniGraffle and pays me. 🙂

👍 4
bherrmann16:10:25

Im a fan of http://plantuml.com/ I write my system descriptions in edn, then write a transformer to create the text to pipe into plant uml.

lread18:10:25

Ya that's cool! If you are an asciidoctor user, many of these textual descriptions can be embedded in your doc and rendered by asciidoctor diagram https://asciidoctor.org/docs/asciidoctor-diagram/

👍 4
theeternalpulse17:10:59

I started the book but didn't dive deep into it. Hard to run through after doing clojure I found.

slipset19:10:38

I really love the fact that the guru in in the Unicorn Project is called Erik. This cannot be a coincidence.

gklijs20:10:51

Most likely not 🙂, didn't know that, will eventually read it.

andy.fingerhut21:10:35

@sova Pinging you in #off-topic channel in case you want to discuss P vs. NP issues here.

andy.fingerhut21:10:57

A well known computational problem long proven to be in P is: given a graph with nodes and edges, each edge having a positive length, is there a path from node A to node B with total cost M or less?

andy.fingerhut21:10:49

It is proved to be in set P by giving an algorithm (or for that problem, we have several good ones) that are guaranteed to terminate with the correct answer in run time that is polynomial in the size of the input.

andy.fingerhut21:10:27

A slightly different problem not known to be in set P, but known to be in NP, is: given a similar input, is there a path from node A to node B (with no nodes repeated) with total cost M or more?

andy.fingerhut21:10:51

The first is called the shortest path problem, the second the longest path problem. No one has published an algorithm for longest paths that is guaranteed to find the correct answer in polynomial time.

andy.fingerhut21:10:05

If you could find such an algorithm, that would be one way to prove that P=NP.

sova-soars-the-sora02:10:37

Would that really prove P=NP ?!

sova-soars-the-sora02:10:16

finding any one successful mapping of a known P problem to a known NP problem makes all P equal all NP ? o.o Please explain this "or more" part. bit fuzzy

gklijs05:10:35

The problem is the algorithm needs to work for all possible given inputs. If you test a graph for the longest path, and you test for a cost smaller than the minimal part, you could have the answer in P. The problem harder once the value gets higher, as you need to prove there is no possible path with a certain length, which seems only possible by trying out all the possible paths making it NP. It's probably or more and not exactly because then maybe you could use some heuristic using all the lenghts?

gklijs05:10:20

Traveling salesman is another famous NP problem, on a similar input, https://en.wikipedia.org/wiki/Travelling_salesman_problem

andy.fingerhut07:10:51

Finding a polynomial time algorithm for a so-called "NP-complete" problem would prove P=NP. "NP-complete" problems are effectively the hardest problems in NP to solve, because if you could find a polynomial time algorithm for any one of them, you can turn it into a polynomial time algorithm for all of the rest of them, too.

sova-soars-the-sora14:10:21

I think it's sufficient to claim that there exists such a transformation from NP to P for every single NP problem. The contra is: prove there are zero mappings from NP-complete problems to P, which (if could be done for one problem) would settle the matter that P is not NP?

sova-soars-the-sora14:10:01

TSP and other problems have been studied to death, I don't think P/NP will be resolved with a graph problem. Graphs are notoriously difficult to untangle, they are straight up bundles of string. Are there any other classes of NP problem you can tell me about? I wonder what the best approach vector would be to try and prove something like this, and I think choosing the right problem(s) is key

andy.fingerhut16:10:08

One of my teachers used this book for a class in the 1980s for teaching the subject: https://en.wikipedia.org/wiki/Computers_and_Intractability

slipset16:10:39

I think that’s the Bible in the subject. My uni used it in the mid nineties.

slipset16:10:52

I still remember working though the proof I believe was from Turing machine to SAT. Don’t remember what it proves though.

andy.fingerhut17:10:54

The basic idea is that it proves you can take any problem instance of the form "simulate this Turing machine with this input, to see whether it answers yes or no to its input", and "encode" it as an instance of the SAT problem. If the answer to the first problem is yes, then the SAT problem will also have yes as the answer, and vice versa. Thus any function foo for solving SAT can be used to solve the Turing machine problem, solved by first doing the transformation in the proof, and then calling 'foo' on that, and you will get the correct answer to the original problem.

andy.fingerhut17:10:06

More basically, programmers frequently will take problem A that they do not have code to solve, and a library B that solves a different problem, and find a way to transform the data for problem A into a form that library B solves for them. The programmer must write code to transform problem A to problem B, and often also code to transform the solution for B back into a form that is the solution to the original problem.