Anonymous user
Talk:Next highest int from digits: Difference between revisions
Talk:Next highest int from digits (view source)
Revision as of 07:41, 24 February 2020
, 4 years ago→Next_permutation: sp.
m (→Next_permutation: sp.) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 27:
==Next_permutation==
Someone on [https://www.reddit.com/r/coding/comments/f796q1/next_highest_int_from_digits/fi9uyx1?utm_source=share&utm_medium=web2x Reddit] r/coding posted a cryptic `std::next_permutation()`. Some searching shows that if it produces the next lexicographic permutation
==Ambiguities in task statement==
Line 40 ⟶ 39:
''Using only the the given digits''
This is as in "Using only a straight edge and a pair of compasses" ?
''Given'' ? What does that mean here ? [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 16:45, 21 February 2020 (UTC)
I think you may be asking us to find the smallest integer larger than the (positive or zero) integer N which can be obtained by reordering the (base 10) digits of N ? [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 16:54, 21 February 2020 (UTC)
:Thanks Hout. I've added your phrasing to. Hopefully between them people will be able to more easily comprehend. Ta. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 17:13, 21 February 2020 (UTC)
==Using Permutations==
Don't sort the permutations and then search for the specified condition. Map the permutations subtracting the original value. Reduce the Mapping to the smallest result greater than 0. If None return 0 else return the original value plus the final result.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:46, 22 February 2020 (UTC)
|