<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>TWO SUM</title><link>https://community.appian.com/discussions/f/new-to-appian/28733/two-sum</link><description>Given an array of integers nums and an integer target , return indices of the two numbers such that they add up to target . 
 You may assume that each input would have exactly one solution , and you may not use the same element twice. 
 You can return</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: TWO SUM</title><link>https://community.appian.com/thread/113038?ContentTypeID=1</link><pubDate>Fri, 19 May 2023 14:46:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ffefa2a-3a24-4c75-9d7e-2f06ac8ffbf4</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!numbs: {2,7,11,15},
  local!target: 9,
  reject(
    a!isNullOrEmpty(_),
    a!forEach(
      items: local!numbs,
      expression: if(
        fv!item &amp;gt; local!target,
        null,
        wherecontains(local!target - fv!item, local!numbs)
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It works aside from Appian arrays index starting at 1.&amp;nbsp; Uses only 1 forEach loop, and should be able to handle multiple correct answers.&amp;nbsp; 15 lines just like the other. =/&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWO SUM</title><link>https://community.appian.com/thread/113031?ContentTypeID=1</link><pubDate>Fri, 19 May 2023 12:39:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:388f561b-642e-4016-929d-badca3a23f83</guid><dc:creator>Srishti Jain</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!num: { 2, 7, 11, 15 },
  local!target:9,
  local!n: {a!forEach(
    items: local!num,
    expression: fv!item + a!forEach(
      items: union(local!num, fv!item),
      expression: fv!item
    )
  )},
  local!loop: a!forEach(items: local!n,
  expression: wherecontains(local!target,tointeger(fv!item))
  ),
  touniformstring(local!loop)
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWO SUM</title><link>https://community.appian.com/thread/113028?ContentTypeID=1</link><pubDate>Fri, 19 May 2023 12:08:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e4477972-694f-4594-81ab-aa4f8a049c0e</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Nice challenge. Do you have any specific question?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>