Golang is strange
I don't like these syntax - so weird. Performing the operations to array/stack/queue is so unfriendly.
func longestValidParentheses(s string) int {
var ans = 0
var st = []int {-1}
for i, c := range s {
if c == '(' {
st = append(st, i)
continue
}
st = st[:len(st)-1]
if len(st) == 0 {
st = append(st, i)
} else {
var t = i - st[len(st)-1]
if t > ans {
ans = t
}
}
}
return ans
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^
NEW! Following my Trail (Upvote or/and Downvote)
Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com
My contributions
- Video Downloader
- Steem Blockchain Tools
- Free Cryptos API
- VPS Database
- Computing Technology Blog
- A few useless tools
- And some other online software/tools
- Merge Files/Videos
- LOGO Turtle Programming Chrome Extension
- Teaching Kids Programming - Youtube Channel and All Contents
Delegation Service
Important Update of Delegation Service!
Support me
If you like my work, please:
- Buy Me a Coffee, Thanks!
- Become my Sponsor, Thanks!
- Voting for me:
https://steemit.com/~witnesses type in justyy and click VOTE
- Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
- Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
- Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses
I support you dear your work is good
Hi @justyy.. I have added my delegate to 2,008,335 SP and I am using you as voting proxy. I hope to get more upvotes from you. Thank you for your attention, Sir.
But you still gotta love the speed of Go when compared to several OO Languages. Go would be my go-to language for AWS lambda functions or any other serverless functions.