CS-OA cs-vo Faang

google VO 算法题记录

Problem I
You are given a string s consisting only of digits '0',"1', ..'g'.Inone move, you can select any two adjacent characters of s and swap them.You are allowed to make any number of moves .

Write a function to determine whether s can be made a palindrome

Example 1
Input: s = "0011"
Output: True

Explanation:“0011"=> "0101" =>"1001"
Example 2
Input: s ="360630"
Output: True
Explanation:“360630" => “306630" => "036630

Problem II

Again, you are given a string s consisting only of digits'0',"1', .,g'. But this time there's no swapping allowed.Instead, in one step, you can change any character of s toany other character .

Let k be a positive integer. Write a function to determinewhether s can be made a palindrome after performing atmost k steps.



Accepting bookings, ensure AC.

We can assist you online with any online assessment, and we can bypass any cheating detection mechanisms, including those that require the use of a camera

contact me to slove OA (Paid )


Leave a Reply

Your email address will not be published. Required fields are marked *