Fraction Addition and Subtraction
@facss That's invalid input. Please read the problem's notes.
@kekezi [ ] means that match any one in the bracket. So [+-] means it can separate a string by + or -. ?= means start from the beginning. If we do not use ?=, for example "3+2+1", the result will just be 1 (ignoring 3+2+). ( ) just means a group.
Upvoted. Rewrote your code in C# but got TLE but it works on my local IDE. And I think your solution is also helpful since it's hard to come up a regex expression check in a real interview....
This is gorgeous
@votrubac said in C++ 12 lines (GCD):
How can you come up with such a good idea?
No one has replied
Nice, I didn't know Fraction takes strings like that.
Your m = re.match(p, expression) is obsolete I guess?
Not sure how I feel about that continue
could turn that elif into
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.