Cody

# Problem 108. Given an unsigned integer x, find the largest y by rearranging the bits in x

Solution 3001627

Submitted on 28 Sep 2020 by Markus Raith
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 76; y_correct = 112; assert(isequal(maxit(x),y_correct))

2   Pass
x = 555; y_correct = 992; assert(isequal(maxit(x),y_correct))

3   Pass
x = 1000; y_correct = 1008; assert(isequal(maxit(x),y_correct))

4   Pass
x = 10000000; y_correct = 16711680; assert(isequal(maxit(x),y_correct))

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.55961585,"math_prob":0.9887137,"size":581,"snap":"2020-45-2020-50","text_gpt3_token_len":182,"char_repetition_ratio":0.17504333,"word_repetition_ratio":0.0,"special_character_ratio":0.37005162,"punctuation_ratio":0.14150943,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9959567,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-12-01T09:51:52Z\",\"WARC-Record-ID\":\"<urn:uuid:8c0b77dd-0c74-47f7-a9b0-b8ca3befd547>\",\"Content-Length\":\"80976\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3798e062-4303-4970-88a9-03ab3568d3d5>\",\"WARC-Concurrent-To\":\"<urn:uuid:ce83a508-8b3b-422f-b1cb-b10449eb40dd>\",\"WARC-IP-Address\":\"23.223.252.57\",\"WARC-Target-URI\":\"https://de.mathworks.com/matlabcentral/cody/problems/108-given-an-unsigned-integer-x-find-the-largest-y-by-rearranging-the-bits-in-x/solutions/3001627\",\"WARC-Payload-Digest\":\"sha1:N7LVMQGGVKKAFFLWNIZIYVSLQSW7G7CC\",\"WARC-Block-Digest\":\"sha1:62QOJLGYJ654ZNRS6STN3Q2Q5S72EWWB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141672314.55_warc_CC-MAIN-20201201074047-20201201104047-00057.warc.gz\"}"}