# coding=utf-8ONE = '('TWO = ')'ONE = '1'TWO = '2'def logic(stream):N = len(stream)list_of_braces_meta = []deepest_loc = 0deepest_known = 0longest_known = 0longest_known_loc = 0for idx in range(N):if stream[idx] == ONE:
# coding=utf-8ONE = '('TWO = ')'ONE = '1'TWO = '2'def logic(stream):N = len(stream)list_of_braces_meta = []deepest_loc = 0deepest_known = 0longest_known = 0longest_known_loc = 0for idx in range(N):if stream[idx] == ONE:
Accepted.
Can the runtime/ memory improved further?
github.com/RahulDamineni/CompetitveProgramming/blob/master/4_results.png
Also, I have a feeling that using Python for these problems making them easier and defeating the purpose. What do you guys think?
# coding=utf-8from collections import defaultdictN1, N2, N3 = map(int, raw_input().split())id_frequencies = defaultdict(int)for _ in range(N1 + N2 + N3):id_frequencies[int(raw_input())] += 1final_list = sorted([ID for ID, freq in id_frequencies.iteritems() if freq > 1])print(len(final_list))for ID in final_list:
Each problem in this list was sourced from some website, this particular one is from CodeChef. (Contest Page)
You should create an account there and submit in the problem home page.
My submission got accepted but is there a scope to improve even more?
I am new to programming and my friend is using stacks for this, so just curious.
# coding=utf-8from __future__ import print_functionimport sysclass Crane:""" A class based on Crane driver's perspective """def __init__(self, W, H, arrangement):""" State vals """self.floor = arrangementself.limit = Hself.width = Wself.holding = Falseself.position = 0def move_left(self):""" Move left if you can """if self.position != 0: