Skip to content

Instantly share code, notes, and snippets.

View hikilaka's full-sized avatar
🤟

Zack Penn hikilaka

🤟
View GitHub Profile
cost_list=#:10,~:5, :0
###############
# # #
# ###### # # #
# # # #
# s ##### #
# # #
# # ######
#~~~~~~# #
# #
# -*- 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'
//
// ViewController.swift
// Guess the Flag
//
// Created by Zack Penn on 3/12/17.
// Copyright © 2017 Zack Penn. All rights reserved.
//
import UIKit
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;
}
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);
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 {
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);
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;
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];
}
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;