This file contains hidden or 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
cost_list=#:10,~:5, :0 | |
############### | |
# # # | |
# ###### # # # | |
# # # # | |
# s ##### # | |
# # # | |
# # ###### | |
#~~~~~~# # | |
# # |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import weechat | |
SCRIPT_NAME = 'mockme' | |
SCRIPT_AUTHOR = 'hikilaka' | |
SCRIPT_VERSION = '1.0.0' | |
SCRIPT_LICENSE = 'none' | |
SCRIPT_DESC = 'Converts your text into a mOcKiNg VeRsIoN' |
This file contains hidden or 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
// | |
// ViewController.swift | |
// Guess the Flag | |
// | |
// Created by Zack Penn on 3/12/17. | |
// Copyright © 2017 Zack Penn. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or 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
template <typename T> | |
struct less_than { | |
private: | |
const T a; | |
public: | |
less_than(const T a) : a(a) { } | |
bool operator()(const T &b) { | |
return b < a; | |
} |
This file contains hidden or 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
std::string reverseParentheses(std::string s) { | |
auto range_start = s.find_last_of('('); | |
auto range_end = s.find(')', range_start); | |
if (range_start == std::string::npos || range_end == std::string::npos) { | |
return s; | |
} | |
auto begin = std::begin(s); | |
auto end = std::begin(s); |
This file contains hidden or 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
bool isSmooth(std::vector<int> arr) { | |
auto first = std::begin(arr); | |
auto last = std::rbegin(arr); | |
if (*first == *last) { | |
if ((arr.size() % 2) == 0) { | |
std::advance(first, arr.size() / 2); | |
auto next = std::prev(first); | |
return (*first + *next) == *last; | |
} else { |
This file contains hidden or 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
bool isLucky(int n) { | |
auto sum = [](auto c) { | |
return std::accumulate(std::begin(c), std::end(c), 0); | |
}; | |
auto str = std::to_string(n); | |
auto left = str.substr(0, str.size() / 2); | |
auto right = str.substr(str.size() / 2); | |
return sum(left) == sum(right); |
This file contains hidden or 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
std::vector<std::string> allLongestStrings(std::vector<std::string> inputArray) { | |
auto begin = std::begin(inputArray); | |
auto end = std::end(inputArray); | |
auto longest_length = std::max_element(begin, end, [](auto a, auto b) { | |
return a.size() < b.size(); | |
})->size(); | |
inputArray.erase(std::remove_if(begin, end, [&](auto s) { | |
return s.size() != longest_length; |
This file contains hidden or 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
int matrixElementsSum(std::vector<std::vector<int>> matrix) { | |
int price = 0; | |
for (int row = 0; row < matrix[0].size(); ++row) { | |
for (int col = 0; col < matrix.size(); ++col) { | |
if (matrix[col][row] == 0) { | |
break; | |
} else { | |
price += matrix[col][row]; | |
} |
This file contains hidden or 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
int matrixElementsSum(std::vector<std::vector<int>> matrix) { | |
int price = 0; | |
int width = matrix[0].size(); | |
int height = matrix.size(); | |
std::vector<std::pair<int, int>> haunted {}; | |
auto flat = std::accumulate(std::begin(matrix), std::end(matrix), std::vector<int>(), | |
[](auto collector, auto row) { | |
collector.insert(std::end(collector), std::begin(row), std::end(row)); | |
return collector; |