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
| Language: Cpp | |
| # BasedOnStyle: Google | |
| AccessModifierOffset: -1 | |
| AlignAfterOpenBracket: Align | |
| AlignConsecutiveAssignments: false | |
| AlignConsecutiveDeclarations: false | |
| AlignEscapedNewlines: Left | |
| AlignOperands: true | |
| AlignTrailingComments: true | |
| AllowAllParametersOfDeclarationOnNextLine: true |
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
| use std::collections::HashSet; | |
| fn files_name(names: Vec<String>) -> Vec<String> { | |
| let mut map = HashSet::new(); | |
| let mut result = vec![]; | |
| for name in &names { | |
| if !map.contains(name) { | |
| map.insert(name.clone()); | |
| result.push(name.clone()); |
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
| fn is_mac48_address(input_string: &str) -> bool { | |
| let mut n = 0usize; | |
| for chunk in input_string.split('-') { | |
| let mut count = 0usize; | |
| for ch in chunk.chars() { | |
| if !ch.is_digit(16) { | |
| return false; | |
| } | |
| count += 1; | |
| } |
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
| fn build_palindrome(st: String) -> String { | |
| let len = st.len(); | |
| let mut i = 0; | |
| let mut j = len - 1; | |
| let chars = st.chars().collect::<Vec<_>>(); | |
| while i < j { | |
| j = if chars[i] == chars[j] { j - 1 } else { len - 1 }; | |
| i += 1; | |
| } |
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
| fn strings_rearrangement(inputs: Vec<String>) -> bool { | |
| let mut marks = vec![false; inputs.len()]; | |
| let found = backtrack(&inputs, &mut marks, "", 0); | |
| found | |
| } | |
| fn backtrack(inputs: &[String], marks: &mut [bool], last: &str, pos: usize) -> bool { | |
| if pos == marks.len() { | |
| return true; | |
| } |
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
| #![allow(unused)] | |
| fn main() { | |
| use std::collections::HashSet; | |
| let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); | |
| let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); | |
| // Can be seen as `a - b`. | |
| for x in a.difference(&b) { | |
| println!("{}", x); // Print 1 | |
| } |
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
| ## Sublime Text 3 Serial key build is 3103 | |
| —– BEGIN LICENSE —– | |
| Michael Barnes | |
| Single User License | |
| EA7E-821385 | |
| 8A353C41 872A0D5C DF9B2950 AFF6F667 | |
| C458EA6D 8EA3C286 98D1D650 131A97AB | |
| AA919AEC EF20E143 B361B1E7 4C8B7F04 | |
| B085E65E 2F5F5360 8489D422 FB8FC1AA |
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
| /* | |
| grab the whole line | |
| char a[100]; | |
| cin.getline(a,100); | |
| scanf("%[^\n]",a); | |
| gets(a); | |
| */ | |
| inline void fastRead_int(int *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
| // open.rs | |
| use std::error::Error; | |
| use std::fs::File; | |
| use std::io::prelude::*; | |
| use std::path::Path; | |
| fn main() { | |
| // Create a path to the desired file | |
| let path = Path::new("hello.txt"); | |
| let display = path.display(); |
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
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| // Name of the struct tag used in examples | |
| const tagName = "validate" |