How can I remove the parenthesis/brackets from my output? /u/TheEyebal Python Education

I am trying to solve two sum problem on leetcode but want to come up with an algorithm that is less than O(n2) time complexity?

Here is my code so far

new_list = [(i , j) for i in range(len(nums_2)) for j in range(i + 1, len(nums_2)) if nums_2[i] + nums_2[j] == target_1] print(list(new_list)) 

How can I remove the parenthesis or brackets around my output.

Output: [(1, 2)]

if i replace the parenthesis around (i , j)it becomes [[1 , 2]]

submitted by /u/TheEyebal
[link] [comments]

​r/learnpython I am trying to solve two sum problem on leetcode but want to come up with an algorithm that is less than O(n2) time complexity? Here is my code so far new_list = [(i , j) for i in range(len(nums_2)) for j in range(i + 1, len(nums_2)) if nums_2[i] + nums_2[j] == target_1] print(list(new_list)) How can I remove the parenthesis or brackets around my output. Output: [(1, 2)] if i replace the parenthesis around (i , j)it becomes [[1 , 2]] submitted by /u/TheEyebal [link] [comments] 

I am trying to solve two sum problem on leetcode but want to come up with an algorithm that is less than O(n2) time complexity?

Here is my code so far

new_list = [(i , j) for i in range(len(nums_2)) for j in range(i + 1, len(nums_2)) if nums_2[i] + nums_2[j] == target_1] print(list(new_list)) 

How can I remove the parenthesis or brackets around my output.

Output: [(1, 2)]

if i replace the parenthesis around (i , j)it becomes [[1 , 2]]

submitted by /u/TheEyebal
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *