4 ms·
here is a naive but working way to do it in ruby : https://gist.github.com/849625 https://gist.github.com/849625
by erwanb 16y ago
here is a naive but working way to do it in ruby : https://gist.github.com/849625 https://gist.github.com/849625
- iworkforthem 16y agoThank you. 0.upto(string.length - password_length) do |index| that's the line of logic I didn't it get correct.
- ntoshev 16y agoPython: max((s[start:end] for start in xrange(len(s)) for end in xrange(start, len(s)) if s[start:end]==s[start:end][::-1]), key=len)