Given an unsigned integer x, convert it to binary with n bits, reverse the order of the bits, and convert it back to an integer.
From now on, anytime I can chain together a composition of functions, I will never exceed a Cody score of 12! Thank you!
I also would encourage people not to submit this sort of dynamic expression regexp trick solutions indiscriminately. Having said that, and just for reference, you can push this down to a Cody score of 10... (hint1: use varargin; hint2: use 'command syntax' instead of 'function syntax').
To keep Cody from degenerating into a bunch of unreadable party tricks, we've blocked usage of eval, evalc, and a few others. But regexp is too important for us to block, so this trick will remain available into the foreseeable future. Which means, to back up Alfonso's comment, please don't abuse it. It's funny once, and then it just gets annoying.
Inner product of two vectors
Sum all integers from 1 to 2^n
Convert a numerical matrix into a cell array of strings
"Low : High - Low : High - Turn around " -- Create a subindices vector
Basic arrays operations.
Give the Shortest Path Through The Maze
Recurring Cycle Length (Inspired by Project Euler Problem 26)
Set a Soroban Abacus
Pull the variable y_correct from the Caller's Workspace
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office