Comments (1)
var twoSum = function(nums, target) {
let ans = [];
let last = nums.length -1;
// use a for loop to iterate array
for(let i = nums.length - 1; i > 0; i--){
let possibleNum = target - nums.pop();
console.log(possibleNum);
if (nums.includes(possibleNum)){
console.log(true);
let position = nums.indexOf(possibleNum);
console.log(position);
ans.push(position, last );
return ans;
}
last--;
}
};
from dsa_practice.
Related Issues (20)
- What are the key differences between HTML, CSS, and JavaScript?
- Can you explain the box model in CSS?
- How do you ensure cross-browser compatibility?
- What are the benefits of using a framework like React for frontend development?
- Can you explain the concept of virtual DOM in React? edit
- How do you manage state in a React application?
- What is responsive design, and how do you achieve it?
- How do you use media queries in CSS?
- What techniques do you use to optimize the performance of a web application?
- How do you handle lazy loading in React?
- What are some common security vulnerabilities in web applications, and how do you mitigate them?
- How do you handle user authentication and authorization in a frontend application?
- What do you think are the key challenges and opportunities in the EdTech industry?
- How do you think technology can improve the learning experience for students?
- How would you design a user-friendly interface for an online learning platform?
- Testing
- Implementing an LMS
- Full Stack Developer - Nigeria | Yeah! Global
- Senior Frontend Developer - Nigeria | Rubystack
- Setup crypto-signing repo HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsa_practice.