Ahh, this old trick. I've done it for at least two interviewers this summer. Terrific way for them to determine how good I am at building Rails applications, but, I digress.
defbalanced?(string,left,right)raiseArgumentError.new("Can't compare individual characters to a character sequence")ifleft.length>1||right.length>1string.chars.reduce(0)do|count,char|returnfalseifcount<0count+=1ifchar==leftcount-=1ifchar==rightend.zero?enddefareCurlyBracesMatched(string)balanced?(string,"{","}")end
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ahh, this old trick. I've done it for at least two interviewers this summer. Terrific way for them to determine how good I am at building Rails applications, but, I digress.