Am I as good as I was in my 20s? No. But the truth is that most people can't do the simple recursion... very few places will deny you employment because you can't invent original algorithms on the spot. They'd just fail tou for simple examples like the one you presented. The amount of people who can't do a tree traversal unless it's DFS is staggering. (and in all honesty, not all of them are useless programmers... sometimes people would do amazing stuff despite failing basic algorithmic tasks. That's what makes hiring decisions so hard.)
[edit] > Can you give me some examples of better things that actually require 20yrs of experience ?
I saw this just now. Lots of things can use said 20yrs of experience... maybe even some CRUD apps (e.g. to know what to not over-design). Some things you probably can't do right without extensive experience (say, design a new programming langugage; or a new datastore). E.g. Rich Hickey famously designed Clojure because he wanted a better way to do those "CRUD apps". Also, it's quite easy to find a hard problem that you won't solve without extensive experience, no matter how smart you are (say: collaboration, data management & versioning in large AI teams). Pretty much any open-ended problem, really... remove all constraints and most programmers will get stuck. How many people can start with "void main()" (or equivalent) and actually release it to production, if the project takes a non-trivial amount of time to complete?