---
title: "Discussion on \"looking for two indices whose value add to target n\" | Hashnode"
description: "Discussion on \"looking for two indices whose value add to target n\". o(n^2)\ndef quad_find(s, n):\n    slen = len(s)\n\n    for i in range(slen):\n        for j in range(slen-1):\n            if s[i] + s[j+1] == n:\n                return (i, j+1)\n\n    return None\n\nIn the provided Python function, 's' represents a list and '..."
url: "https://hashnode.com/posts/looking-for-two-indices-whose-value-add-to-target-n/65491475e4d5fec6421c39e9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [looking for two indices whose value add to target n](https://kyrie.hashnode.dev/looking-for-two-indices-whose-value-add-to-target-n?utm_source=hashnode&utm_medium=feed)

o(n^2) def quad\_find(s, n): slen = len(s) for i in range(slen): for j in range(slen-1): if s\[i\] + s\[j+1\] == n: return (i, j+1) return None In the provided Python function, 's' represents a list and '...

Nov 6, 2023 · 1 min read · kyrie.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)

## Written by

[Xuanji Zhu](https://hashnode.com/@Kyriee)

@Kyriee · Singapore

  
[View profile](https://hashnode.com/@Kyriee)

Deeper

I'm currently a student at the National University of Singapore, majoring in System Analysis. Although I'm relatively new to the world of computer science and English writing, I'm eager to share my personal insights and understanding of computer science through this blog. Feedback, corrections, and interactions are highly welcomed and appreciated!

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
