Giter Club home page Giter Club logo

first's Introduction

first

现在我大致更明白如何使用github 不过这样的过程还是需要时间,即如何熟练的用命令行使用github。并且达到充分运用github的功能

代码插入


3Sum


#include<iostream>
using namespace std;
class solution{
public:
	std::vector<std::vector<int> > threesum(std::vector<int> &num){
		std::vector<char> ret;
		if (num.size()<=2)
		{
			/* code */
			return ret;
		}
		sort(num.begin(),num.end());
		for (int i = 0; i < num.size()-2; ++i)
		{
			int j=i+1;
			int k=num.size()-1;
			while (j<k)
			{
				if(num[i]+num[j]+num[k]==0)
				{
					ret.push_back(num[i]);
					ret.push_back(num[j]);
					ret.push_back(num[k]);
					j++;
					k--;
				
				while(j<k&&num[j]==num[j-1])

				{
					j++;
					/* code */
				}
				while (j<k&&num[k]==num[k-1])
				{
					k--;
				}
			    }
			    if(num[i]+num[j]+num[k]<0)
			    {
			    	j++;
			    }
			    else
			    {
			    	k++;				  
			    }
			    while(i<num.size()-1&&num[i]==num[i+1])
			    {
			    	i++;
			    }
			}
			/* code */
		}
	}
}

first's People

Contributors

magnetowang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.