• Learn
    • Courses
    • Career Tracks
    • Projects
    • Upcoming Courses
  • Certificates
    • Career Track Certificate
    • Course Certificate
  • Resources
    • All Resources
    • Course Notes
    • Templates
    • Infographics
    • Career Guides
    • Practice Exams
    • Blog
    • Reviews
    • Success Stories
    • Flashcards
    • Calculators
    • Interview Simulator
  • Pricing
  • Corporate Training
  • Login
  • Sign Up
Log In Sign Up
Follow this topic
Share
Bhaskar Jha
Posted on:

20 Nov 2022

0

My solution. Without Dictionary but is it bruteforce or efficient one?

in Python Programmer Bootcamp / Two sum solution
def two_sum2(lst, target):
    for i in range(len(lst)):
        if target - lst[i] in lst[i+1:]:
            return (lst.index(lst[i]), lst.index(target-lst[i]))
    return -1
0 answers ( 0 marked as helpful)

Submit an answer

GET

World-Class

Data Science

Courses

Learn with instructors from:

4.9/5

related questions

Carl Angelo Catchola
1
12
How did it go with your solution?
Osama Nawas
1
6
key of Dictionary
Ashakah Onome Andrew
0
6
Caesar cipher solution: 'NoneType' object has no attribute 'lower'
Elisha Tiu
0
6
I do not understand the second part of the solution, please help.
Carl Angelo Catchola
0
6
Resolved: Two_sum solution: Order of the lines of code
wahab sultan
0
6
Python dictionary time 9:21
Floyd Anderson
1
4
Alternative solution
Avtandil Chakhnashvili
2
4
Solution to the last task
Christine Li
0
4
Have codes exactly like what the teacher shows but can't make it work
Klim Peshkov
0
4
Resolved: Two Sum problem - Solution with pre-generated dictionary
Joel Rehm
0
4
Resolved: Error messege when using your solution: please help
Swarntam Saurav
1
4
Luhn's algorithm Solution

All the Data Science Courses You Need

About

  • About Us
  • Meet the Instructors
  • Become an Instructor
  • Contact Us
  • Pricing

Learn

  • Courses
  • Career Tracks
  • Career Certificate
  • Course Certificate

Resources

  • Course Notes
  • Templates
  • Career Guides
  • Practice Exams
  • Calculators
  • Flashcards
  • Blog

Platform

  • Success stories
  • Q&A Hub
  • Help Center
  • Verify Certificate

Business

  • Corporate Training
  • Team Plan
  • Live Training

Business

  • Corporate Training
  • Team Plan
  • Live Training
© 2025 365 Data Science. All Rights Reserved.
Sitemap Terms of Use Privacy Policy Cookies