Have an on-line call at 02:30 PM. I believe I am well prepared. Will see how it goes.
Earlier today I selected LeetCode 814 Binary Tree Pruning problem.
We are given the head node root of a binary tree,
where additionally every node's value is either a 0 or a 1.
Return the same tree where every subtree (of the given tree)
not containing a 1 has been removed.
(Recall that the subtree of a node X is X, plus every node that is a descendant of X.)
o The binary tree will have at most 200 nodes.
o The value of each node will only be 0 or 1.
We are given a binary tree whose nodes are holding 0 or 1 as value. We need to prune the BT as described in the requirements. If you are interested in this problem please navigate to the LeetCode web site and read the actual requirements. In addition LeetCode has a set of test cases.
In this post we will solve the problem using the Java programming language on a Windows 10 computer using the VSCode IDE. You can use any of the languages supported by LeetCode and solve the problem on the LeetCode side with the IDE provided. Continue reading “Binary Tree Pruning”
The temperature in the Twin Cities of Minneapolis and St. Paul continues to oscillate between negative and positive values in the Fahrenheit scale. The good thing is that we are around mid February. This year spring starts Saturday March 20. That is about 6 to 7 weeks from today. Continue reading “All Elements in Two Binary Search Trees”
Today is January 20, 2021 and is the United States presidential inauguration. Not sure what to expect today or in the following days. Hope all goes well and we can move forward. I believe most of the people in our country are tired of reading and watching political news and propaganda.
Yesterday I attended an ACM webinar “Agent-Human Collaboration and Learning for Improving Human Satisfaction” by Sarit Kraus. She is a professor of computer science at the Bar-Ilan University in Israel.
What called my attention was the concept of having agents for both the automation and the human. I can easily see how that would work in a healthcare or a disaster scenario I do not see how that could work well with autonomous cars. I will go over the slides tomorrow and see if I missed something; otherwise I will send her a message. Hopefully she will have time to respond. Will let you know my findings. Continue reading “Merge Sort in Java”
Today is Friday. The current temperature is about 40 F which is not bad for this time of the year. Tomorrow is my youngest sister birthday. I believe she is still in China. I will send her a message wishing her a nice day.
I have a few problems solve from a Facebook coding practice questions site. I should post them over the weekend if something else does not come up. My wife and I are planning on getting groceries done at the end of the day so we can remain at home over the weekend. Grocery stores tend to have much more activity on weekends. Continue reading “Encrypted Words”
Hi gals and guys. Hope you are doing well during the COVID-19 pandemic. It seems that most of us are somewhat tired following the basic rules that reduce the spread of the coronavirus. By relaxing the rules in the past few months, the numbers of COVID-19 infections, in most cities worldwide, are going up. Note that the issue is the number of infections, not the number of deaths. Infected people may need hospital services. If the number of patients is larger than the capacity like it was when this thing started, then we have a problem. At this point in time, people with most infections per 1,000, is people in college age. Please follow the rules! We all benefit from it. Continue reading “Print Immutable Linked List in Reverse”
Today in the Twin Cities of Minneapolis and St. Paul we had snow on and off for several hours. It does not seem we have any accumulation on the road surface. This might change tomorrow. Snow is expected for most of the day. It seems winter has arrived.
A friend mentioned the article “Tokyo citizens may have developed COVID-19 herd immunity, say researchers” by Sally Robertson. If interested, read the article and then continue reading this post… Continue reading “Dynamic Programming Revisited”
Yesterday afternoon the technician for a company that cleans ducts showed up for our appointment. Our dryer was having issues with the exhaust duct. We had to clean the dryer filter and restart the unit over a dozen times per load.
The technician arrived half hour earlier. I showed him the location for the exhaust and the dryer. He brought in some type of industrial vacuum and some hoses. I believe he used a camera to watch the operation while vacuuming the duct. Continue reading “Recursive Digit Sum”
This week has gone by so fast; at least it seems so. We have to take into account that Monday was Labor Day so most people, including myself, had the day off. Today is Friday and it is almost lunch time. I am done with a work task, so I decided to get this post done, have lunch and then start the next work task this afternoon.
There is a lot of code, but I generated a candidate for a solution that seemed to work but was too slow to be accepted by LeetCode. Let me elaborate on the specifics. Continue reading “Maximum Width of a Binary Tree”
Labor Day weekend 2020 is here. The temperatures in the Twin Cities of Minneapolis and St. Paul are getting lower. Given COVID-19, the Minnesota State Fair has been postponed this year. My wife and I are not fair goers. We have been there twice. Our oldest son, who lives in this area, tends to go at least once a year.
Yesterday my wife and I grilled a whole chicken and some steak. There were chicken leftovers for the week. Not sure what we will grill for lunch today. Today the high temperature will be in the lower 80’s. It should be a great day to grill. Continue reading “All Possible Full Binary Trees”
Hope you are having a great day. Apparently I had too much to say out of topic in my last post. Thanks for the message. I will keep it short.
During the workdays my wife prepares lunch while I work in my office. On occasions she asked me to fire the grill to cook the meal. We try to make enough food over the weekends so there are enough leftovers to simplify the process on workdays. That said, it seems that today would have been a great day to grill outside. The morning started at 56 F and the forecast calls for 77 F for a high. The day will be sunny. It seems that it is going to be a perfect day. Continue reading “Nth Tribonacci Number”