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
openapi: 3.0.0 | |
info: | |
title: NodeBB Read API | |
version: 1.15.0 | |
contact: | |
email: [email protected] | |
license: | |
name: GPL-3.0 | |
description: >- | |
# Overview |
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
#You are given an array of n integers, ar = [ ar[0], ar[1],...,ar[n-1]] , and a positive integer, k. Find and print the number of (i, j) pairs where i<j and ar[i]+ ar[j] is divisible by k. | |
def divisibleSumPairs(ar, k) | |
ar.combination(2).to_a.select{ |a| (a.index(a[0]) < a.index(a[1])) && ((a[0] + a[1]) % k == 0)}.count | |
end | |
array = [1, 2, 3, 4, 5, 6] | |
x = 5 | |
p divisibleSumPairs(array, x) |
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
bool get hasScrolledBody { | |
for (_NestedScrollPosition position in _innerPositions) { | |
if ( | |
position.minScrollExtent != null && | |
position.pixels != null && | |
position.pixels > position.minScrollExtent | |
) { | |
return true; | |
} | |
} |
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
# Assume we have a list of words from the English dictionary, like: | |
# english_words = ["water","big","apple","watch","banana","york","amsterdam","orange","macintosh","bottle","book"] | |
# And another long list of string to process, write a function to identify "compound words" and return them: | |
# output: ["applewatch","bigbook","waterbottle"] | |
english_words = ["water","big","apple","watch","banana","york","amsterdam","orange","macintosh","bottle","book"] | |
inputWords = ["paris","applewatch","ipod","amsterdam","bigbook","orange","waterbottle"] |
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
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context)=> MaterialApp( | |
title: 'Nested Views', | |
theme: ThemeData( | |
brightness: Brightness.light, | |
primaryColor: Color(0xFF44318e), | |
accentColor: Color(0xFFe98074), | |
fontFamily: 'Quicksand', |
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
import 'dart:convert'; | |
import 'dart:math'; | |
import 'dart:typed_data'; | |
import 'package:asn1lib/asn1lib.dart'; | |
import 'package:convert/convert.dart' as convert; | |
import 'package:ejenti_master_agent/myGenerator.dart'; | |
import 'package:encrypt/encrypt.dart'; | |
import 'package:pointycastle/export.dart'; |
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
def subsets(items): | |
subsets = [] | |
for code in range(0, 2**len(items)): | |
code = ("{0:0" + str(len(items)) + "b}").format(code, len(items)) | |
print(code) | |
# for i in range(0,len(items)): | |
subset = set() | |
for i, c in enumerate(code): |
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
#Julius and Mercy Quadratic Equation Solver | |
#Implementation of the formula x= (-b+- (b**2-4ac)**2)/2a | |
def quad_values(a,b,c) | |
a = a.to_f | |
b = b.to_f | |
c = c.to_f | |
d = (b**2) - (4*a*c) | |
if d >= 0 | |
d = Math.sqrt(d) |
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
def product_array(arr) | |
prd=1 | |
arr.each do |x| | |
x > 0 ? prd= prd*x : prd = prd | |
end | |
prd | |
end | |
def new_array (arr) | |
zero_count = arr.count(0) |
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
def product_array(arr) | |
prd=1 | |
arr.each do |x| | |
x > 0 ? prd= prd*x : prd = prd | |
end | |
prd | |
end | |
def new_array (arr) | |
zero_count = arr.count(0) |
NewerOlder