Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child
ihas a greed factorg[i], which is the minimum size of a cookie that the child will be content with; and each cookiejhas a sizes[j]. Ifs[j] >= g[i], we can assign the cookiejto the childi, and the childiwill be content. Your goal is to maximize the number of your content children and output the maximum number.
10034. Palindrome Rearrangement Queries
You are given a 0-indexed string
shaving an even lengthn.You are also given a 0-indexed 2D integer array,
queries, wherequeries[i] = [ai, bi, ci, di].For each query
i, you are allowed to perform the following operations:
- Rearrange the characters within the substring
s[ai:bi], where0 <= ai <= bi < n / 2.- Rearrange the characters within the substring
s[ci:di], wheren / 2 <= ci <= di < n.For each query, your task is to determine whether it is possible to make
sa palindrome by performing the operations.Each query is answered independently of the others.
Return a 0-indexed array
answer, whereanswer[i] == trueif it is possible to makesa palindrome by performing operations specified by theithquery, andfalseotherwise.
- A substring is a contiguous sequence of characters within a string.
s[x:y]represents the substring consisting of characters from the indexxto indexyins, both inclusive.