Saturday, March 13, 2021

Leetcode Everyday: 1374. Generate a String With Characters That Have Odd Counts. Easy

public class Solution {
    public string GenerateTheString(int n) =>
        new string('a', n - (n%2 ^ 1)) + new string('b', 1 - n%2);
}
Source: https://leetcode.com/problems/generate-a-string-with-characters-that-have-odd-counts/

No comments:

Post a Comment