Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Continuous Sub Set with given sum
//Title of this code #include <iostream> #include <vector> using namespace std; void continuousSubSet(vector<int>& t, int sumToFind) { for (int i = 0; i < t.size(); ++i) { int sum = 0; for (int j = i; j < t.size(); ++j) { sum += t[j]; if (sum == sumToFind) cout << i << " - " << j << endl; } } } int main() { vector<int> t; t.push_back(1); t.push_back(1); t.push_back(2); t.push_back(1); t.push_back(3); t.push_back(5); t.push_back(-1); t.push_back(5); continuousSubSet(t, 4); }
run
|
edit
|
history
|
help
0
Round prices
Kalkulator z bajerami
CPPTemplate
Bimap operations
Изволов#2
Microsoft Question - MaxEmployeeAttendence (original question)
Summation Of Primes
Policy based smart pointer
Two-phase sample with GCC
VecHotel3