| 13 | class Solution { |
| 14 | public: |
| 15 | vector<int> beautifulArray(int N) { |
| 16 | vector<int> res = {1}; |
| 17 | while (res.size() < N) { |
| 18 | vector<int> tmp; |
| 19 | for (int i : res) if (i * 2 - 1 <= N) tmp.push_back(i * 2 - 1); |
| 20 | for (int i : res) if (i * 2 <= N) tmp.push_back(i * 2); |
| 21 | res = tmp; |
| 22 | } |
| 23 | return res; |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | int main() { |
nothing calls this directly
no outgoing calls
no test coverage detected