A. Do Not Be Distracted!
Scan the string. When we found a new letter, we skip the continually same letter. And mark this letter should not present again. If it presents again, then output "NO".
B. Ordinary Numbers
Construct beautiful numbers within 9 digits from 1-9. Count the number if it less than n.
C. Not Adjacent Matrix
Fill in the numbers along the diagonal. Take $ n = 5 $ as an example:
D. Same Differences
Transform the equation, then we get $a_j - j = a_i - i$. So, scan the array, count the number of every $a_x - x$. And calculate the sum of $C_n^2$.
E. Arranging The Sheep
In fact, it depends on how many sheep go to the left and how many sheep go to the right.
F. Guess the K-th Zero (Easy/Hard Version)
Binary search. Query the range $[1,mid]$. But it will change the number in hard version. And we need plus one for some of our caches. So, of course, it's a segment tree problem.
G. To Go Or Not To Go?
I solved similar problem before. Do BFS from starting and ending point first. Then we consider if use the transport portal or not. I remember last time, I also get TLE by using Dijkstra.