<>1556. thousands separator

<>
analysis

* Split and splice from back to front , Finally, flip the output class Solution { public String thousandSeparator(int n)
{ if(n / 1000 == 0) return String.valueOf(n); // If n less than 1000, Then output directly without adding a separator
StringBuilder sb= new StringBuilder(); int count = 0; // How many digits are there now while(n > 0) {
if(count == 3) { // If there are already three , You need to add a separator , And set the number of times 0 sb.append("."); count = 0; } int temp =
n% 10; count++; sb.append(temp); n = n / 10; } return sb.reverse().toString();
} }
<>1576. Replace all question marks

<>
analysis

* One by one comparison class Solution { public String modifyString(String s) { char[] ch = s.
toCharArray(); for(int i = 0; i < ch.length; i++) { if(ch[i] == '?') {
// If the current character is ? char left = (i == 0 ? ' ' : ch[i - 1]); // Find the element on the left , And judge whether it is the first element char
right= (i == ch.length - 1 ? ' ' : ch[i + 1]); // Find the element on the right , And judge whether it is the last element char temp =
'a'; while(temp == left || temp == right) // Loop to find characters that are not the same as left and right characters temp++; ch[i] =
temp; } } return new String(ch); } }

Technology
©2020 ioDraw All rights reserved
python gui Interface examples -Python GUI Programming complete example IO flow —— Classification of flow ,InputStream,OutputStream,Reader,Writer etc. Thread.setDaemon Set up the Daemons STM32 RS485 modbus Communication source program , The test is effective stay MATLAB 2018 Time series prediction with deep learning vue3 Write component library and publish to npm The process of Questions and answers for the interviewer : How did you get a project in the project team ??? In the applet form Multiple cycles input How to get each input Value of 2021 Front end high frequency interview questions ( You have to watch it !!!)js Array method