본문 바로가기

Computer General

Palindrome Permutation Given a string, determine if a permutation of the string could form a palindrome. Example 1: Input: "code" Output: false Example 2: Input: "aab" Output: true Example 3: Input: "carerac" Output: true class Solution { public: bool canPermutePalindrome(string s) { map hmap; for(int i = 0; i
Moving Average from Data Stream Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new MovingAverage(3); m.next(1) = 1 m.next(10) = (1 + 10) / 2 m.next(3) = (1 + 10 + 3) / 3 m.next(5) = (10 + 3 + 5) / 3 class MovingAverage { private: vector window; int capacity; int current_size; double sum; int start; int end; public: /** Initialize your..
Intersection of Three Sorted Arrays Given three integer arrays arr1, arr2 and arr3 sorted in strictly increasing order, return a sorted array of only the integers that appeared in all three arrays. Example 1: Input: arr1 = [1,2,3,4,5], arr2 = [1,2,5,7,9], arr3 = [1,3,4,5,8] Output: [1,5] Explanation: Only 1 and 5 appeared in the three arrays. Constraints: 1
Nested List Weight Sum Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- whose elements may also be integers or other lists. Example 1: Input: [[1,1],2,[1,1]] Output: 10 Explanation: Four 1's at depth 2, one 2 at depth 1. Example 2: Input: [1,[4,[6]]] Output: 27 Explanation: One 1 at depth 1, one 4 at depth 2, and one 6 ..
VB.NET 기본 문법 (Variables and operators) Dim As [= ]Dim numberOfCows As IntegerDim temperature As SingleDim sentense As String = "Hello everyone!"Dim hasPaid As Boolean = False ```Module Module1 Sub Main() Dim x As String = "Hello World" Console.Write("The value is ") Console.WriteLine(x) Console.ReadLine() End Sub End Module``` 1. Modulus: x = 2Mod52. Power Of: x = 2^53. Concat: s = "Hello " & "World"
Hello world with VB.net project 새로 생성하고 나면.. 항상- My project- App.config- module1.vb가 생성됨. module1.vb가 코딩할 부분 ```Module Module1 Sub Main() Console.WriteLine("Hello World") Console.ReadLine() // read press enter End Sub End Module ``` ```Module Module1 Sub Main() Console.WriteLine("Hello world") Console.WriteLine("Welcome to my series") Console.ReadLine() Console.Clear() Console.WriteLine() Console.WriteLine() Console.Wr..
VB.NET 기본 개념2 .net 이 들어가면..: 하나가 아니라 여러개의 집합체. 서로 다른 프로그램의 통일성을 만들어주는 하나의 플랫폼.: 모든 개발 환경이 표준화 되어있다. : C#도 있고 VB도 있고 * VB.net 2013 introduction- uses the microsoft .net framework for lots of functions- Advantages1. Quick and easy to develop application2. Simple and easy to use syntax3. Extremely supported by Microsoft and community- Disadvantages1. Slow when compared to others (like C++)2. create large executa..
VB.Net 기본개념 Visual Studio.net= VB + C# + JSCRIPT + C++==> CLR (Common Language Runtime) * CLR- 프로그램을 메모리로 로딩하고 프로그램을 컴파일함. 이 때 컴파일은 source->machine language 로 번역된 상태로 만드는 것 (중간언어로: LI, Assembly). - .net에서 실행 엔진. - .net 언어로 작성된 모든 코드는 여기서 실행되고 관리함- 어셈블리, .net에서 실행 또는 배포 가능한 최소의 작업단위- 컴파일된 코드들이 저장되는 단위- JAVA와 같이 메모리 관리하는 기능 제공- Jit 컴파일러(Dynamic compiler)가 실행 해줌 * JIT Compiler- Just in time- 실행을 할 때만 필요한 양만큼 컴..
File Input/Output #include #include //need to include this(stream textfile in and out) using namespace std; int main() { ofstream myfile; //create an object that allows outputfiles to create file myfile.open("newfile.txt"); //it would create a file for you if not exists... myfile >word; //get the value while(bucky.good()){ // good => as long as it's not eof cout
Structures #include #include struct newperson { //members(all of bits of information) //person's name char name[20]; int age; }; int main() { using namespace std; //1. declaration of newperson newperson bucky = { "Bucky", 21 }; //then how can we use? cout