# FaceBook Hacker Cup Balanced Smiley Problem

Page 1 of 1

## 1 Replies - 284 Views - Last Post: 25 January 2013 - 08:05 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=309370&amp;s=7aa7ade39a92c3aaab009a2d8f5285c7&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 robinruet

• New D.I.C Head

Reputation: -1
• Posts: 18
• Joined: 11-September 11

# FaceBook Hacker Cup Balanced Smiley Problem

Posted 25 January 2013 - 08:02 PM

Hi, I am working on 2nd solution.
I have made this code.
http://pastebin.com/PD0JPeDf

Problem Link : http://www.facebook....185564241586420

I am bit confused about the problem and that is

They said
A message has balanced parentheses if it consists of one of the following:

- An empty string ""
- One or more of the following characters: 'a' to 'z', ' ' (a space) or ':' (a colon)
- An open parenthesis '(', followed by a message with balanced parentheses, followed by a close parenthesis ')'.
- A message with balanced parentheses followed by another message with balanced parentheses.
- A smiley face "" or a frowny face ""

SO if any of those statement is true, It will be balanced.

But they said ( is not balanced, but is satisfy the last term. So why it is not balanced?

Is This A Good Question/Topic? 0

## Replies To: FaceBook Hacker Cup Balanced Smiley Problem

### #2 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 11039
• Posts: 41,315
• Joined: 27-December 08

## Re: FaceBook Hacker Cup Balanced Smiley Problem

Posted 25 January 2013 - 08:05 PM

We're not helping you cheat in a programming competition. If you can't write the code, you don't deserve to win or advance.
Was This Post Helpful? 1

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }