Skip to content

Instantly share code, notes, and snippets.

View seansio1995's full-sized avatar
🎯
Focusing

just we seansio1995

🎯
Focusing
View GitHub Profile
class Solution(object):
def convertBST(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
self.val=0
def traverse(root):
if root:
def countBinarySubstrings(self, s):
s = map(len, s.replace('01', '0 1').replace('10', '1 0').split())
return sum(min(a, b) for a, b in zip(s, s[1:]))

This is only my personal opinion, and other TAs probably will differ/should also post their opinions.

Java and C++ are really very similar. Java is more strictly object oriented than C++, and C++ lets the programmer have more low-level control (or rope with which to hang themselves, depending on how you look at it), but the paradigms they enforce are largely the same. So, when considering a new language to learn, we really have to consider what we'll get out of it - what about the language makes it worth learning. There are a few factors here. First, as the student answers have mentioned, the practicality of a language is important. If knowing a language might be necessary to get you a good job or to allow you to contribute meaningfully to a large open-source project, it might be a good idea to learn it. Second, you also need to look at how the language can help you in a larger sense. Does it use a unique paradigm, or one you haven't encountered before? Can it introduce you to new ways of thinking about and