This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
test input: | |
[2,7,11,15] | |
9 | |
------------ | |
output: | |
[0, 1] | |
------------ | |
*/ | |
class Solution { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for a binary tree node. | |
* struct TreeNode { | |
* int val; | |
* TreeNode *left; | |
* TreeNode *right; | |
* TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
* }; | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for singly-linked list. | |
* struct ListNode { | |
* int val; | |
* ListNode *next; | |
* ListNode(int x) : val(x), next(NULL) {} | |
* }; | |
*/ | |
class Solution { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
vector<int> twoSum(vector<int>& nums, int target) { | |
map<int, int> hashTable; | |
vector<int> outVec; | |
int i; | |
for(i=0; i<nums.size(); i++){ | |
map<int, int>::iterator it = hashTable.find(target-nums[i]); | |
if(it != hashTable.end()){ | |
outVec.push_back(it->second); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
int lengthOfLongestSubstring(string s) { | |
int i, j; | |
int maxLen=0; | |
int maxIndex=0; | |
int sLen = s.length(); | |
int substringLen=0; | |
for(i=0; i<sLen; i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "(gdb) Launch", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${workspaceRoot}/${fileBasenameNoExtension}.o", | |
"args": [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build", | |
"type": "shell", | |
"command": "gcc", | |
"args": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@setlocal | |
@echo off | |
if NOT EXIST build_v140_x64 ( | |
mkdir build_v140_x64 | |
) | |
pushd build_v140_x64 | |
:: Setup the environement for VS 2015 x64 | |
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 | |
:: configure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
@setlocal EnableDelayedExpansion | |
:: Default values | |
if DEFINED APPVEYOR ( | |
echo Setting Appveyor defaults | |
if NOT DEFINED MSVC_VERSION set MSVC_VERSION=14 | |
if NOT DEFINED WITH_NINJA set WITH_NINJA=0 | |
if NOT DEFINED CPU_ONLY set CPU_ONLY=0 | |
if NOT DEFINED CUDA_ARCH_NAME set CUDA_ARCH_NAME=Auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GDB online Debugger | |
https://www.onlinegdb.com/ | |
*/ | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define ALL(x) x.begin(), x.end() | |
OlderNewer