Adding a node to the linked list takes longer if a reference to the end node is used

I try to add two numbers in the form of a linked list and return their result in a linked list, as specified in https://leetcode.com/problems/add-two-numbers/.

Question:

You get two non-empty linked lists that represent two non-negative integers. The numbers are stored in reverse order and each node contains a single digit. Add the two numbers and return them as a linked list.

You can assume that the two numbers except the number 0 itself do not contain a leading zero.

Example:

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807, My solution has solved all test cases, but after refactoring it takes longer than the original code

Solution 1:

    / **
* Definition for simply linked list.
* public class ListNode {
* public int val;
* public ListNode next;
* public ListNode (int x) {val = x; }
*}
* /
public class solution
{
public ListNode AddTwoNumbers (ListNode l1, ListNode l2)
{
ListNode l3 = null;
int carry = 0;
while (l1! = null || l2! = null)
{
int first = 0, second = 0;
if (l1! = null)
{
first = l1.val;
l1 = l1.next;
}
if (l2! = null)
{
second = l2.val;
l2 = l2.next;
}
int digit = first + second;
if (carry! = 0)
{
Digit = digit + carry;
Transmit = 0;
}

if (digit> 9)
{
Transmit = digit / 10;
Digit = digit% 10;
}

AddLastNode (Digit, ref 13);

}

if (carry! = 0)
{
AddLastNode (carry, ref 13);
Transmit = 0;
}
return l3;
}
// Here I go through the linked list each time to find the end node
private static void AddLastNode (int digit, ref ListNode l3)
{
if (l3! = null)
{

AddLastNode (Digit, ref l3.next);

}
otherwise
{
l3 = new ListNode (Digit);
}

}
}

To avoid running through all nodes, I use a reference for the end node in the following solution

Solution 2:

            public class Solution {
public ListNode AddTwoNumbers (ListNode l1, ListNode l2)
{
ListNode l3 = null;
ListNode tailNode = null;
Int rest = 0;
while (l1! = null || l2! = null)
{
int sum = 0;
if (l1! = null)
{
sum = l1.val;
l1 = l1.next;
}

if (l2! = null)
{
sum + = l2.val;
l2 = l2.next;
}

if (rest! = 0)
{
Sum + = remainder;
}

if (sum> 9)
{
Remainder = sum / 10;
sum = sum% 10;


}
otherwise
{
Remainder = 0;
}
// Here I use tailNode with the reference to add a new node at the end of the linked list
if (tailNode == null)
{
l3 = new ListNode (sum);
tailNode = l3;
}

otherwise
{
tailNode.next = new ListNode (Sum);
tailNode = tailNode.next;
}

}
if (rest! = 0)
{
tailNode.next = new ListNode (remainder);
}
return l3;
}

}

Since I got an end node for the end of the linked list instead of going through the entire linked list, I thought that Solution 2 performs better. However, the execution still takes longer than the first solution. Changes to the code are desired

Enter image description here

The execution of solution 1 takes 108 ms, while the execution of solution 2 takes 140 ms

sharepoint online – JSLink for the same list view web part on a page hides some fields

We need to create a single jslink file for two equal list view Web Parts that are configured on the same page

Here are the rendering rules that are defined

  1. The first Web Part should contain some columns that you want to show or hide
  2. The second Web Part should contain some columns that you want to show or hide.

We found out something for conditional rendering
ctx.wpq == "WPQ3"

How can we render the view with such a condition?
Any help would be appreciated?

Views – How can I list the previously published revisions of a node?

I have enabled workbench moderation and revisions for my content type.

How can I list all previously published revisions of a node in views?

I have created a node with Revision 1 and published

Then I updated the node that was created Revision 2

Then I updated the node again and published Revision 3,

Now I want to create a view that is just listed Revision 1 and Revision 3 as they are / have been published revisions. And the Revision 2 should not be displayed in the list.

Is this possible via views, and is there a record in the database that states that this revision is a published revision on that node?

List View with SQL Lite and CheckBox in List View Problem: How do I get SQL data when I select chekbox?

I have 3 classes: Items, AdapterItems, Main Class 2 Layout: Show List, Main Layout.

Code of class objects:

Here I create the objects

package com.example.myapplication;
import android.widget.CheckBox;

public class Items {
private string PriceProduct;

public items (String Productprice) {
this.ProductPrice = ProductPrice;
}

public String getProductPrice () {return ProductValue;}
}

Adapter Items Class Code:

Here I create the adapter

package com.example.myapplication;

import android.content.Context;
android.view.LayoutInflater Import;
android.view.View import;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;


public class Adapter Items extends BaseAdapter {
private context context;
private ArrayList listItems;

public Adapter Items (context context, ArrayList listItems) {
this.context = context;
this.listItems = listItems;
}

// Count the objects to load
@Override
public int getCount () {
return listItems.size ();
}

// return the list
@Override
public object getItem (int position) {
return listItems.get (position);
}

//
@Override
public long getItemId (int position) {
return 0;
}

// where the list is created and we assign the values ​​of each element
@Override
public view getView (int position, view convertView, ViewGroup parent) {
Items items = (Items) getItem (position);

convertView = LayoutInflater.from (context) .inflate (R.layout.activity_show_listing, null);
TextView txt Show Price = (TextView) convertView.findViewById (R.id.txt Show Price);

img_avatar.setImageResource (items.getAvatar ());
txt_product.setText (items.getProduct ());
txtShowPrice.setText (items.getProductPrice ());
return convertView;
}
}

Main class calling the layout code:

here is the prolema in the layout I have the chekbox but they are not added in the daptador or in the article class, because from the database, the objects filled the objects with data and the chekbox no data needed, so that only the price object receives information with sql

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
android.media.MediaCodec import;
import android.os.Bundle;
android.view.View import;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
android.widget.Toast import;

import java.util.ArrayList;

public class OrderProduct extends AppCompatActivity {
private ListView lst_items;
private adapterItems adapter;

@Override
protected void onCreate (bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_order_product);

lst_items = (ListView) findViewById (R.id.lst_items);
adapter = new AdapterItems (this, GetArrayItems ());
lst_items.setAdapter (adapter);
}

private ArrayList GetArrayItems () {
ArrayList listitems = new ArrayList <> ();

// Load database records
AdminSQLiteOpenHelper admin = new AdminSQLiteOpenHelper (this, "administration", null, 1);
SQLiteDatabase DataBase = admin.getWritableDatabase ();

Row cursor = DataBase.rawQuery ("Select price from items", null);
if (row.moveToFirst ()) {
do
// Design of records These are objects and we introduce the data of the tables sql into the object lists
listitems.add (new Items (row.getString (0)));

} while (row.moveToNext ());
}
DataBase.close ();

return list items;
}
}

As you can see, the checkboxes with the price text view are repeated. I would like to add the prices according to the list checkboxes. I can not access the check boxes because they are in a different layout to display the list of the design and code in the main layout I can not call the chekbox.

my goal is to display a list of prices and when choosing chekbox i make the sum of the selected or create the object in item, but the item objects get data from the database or i create a class for the layout to list and from there validate the selected data. I am an apprentice, I need help.

Layout Code listlist:




    

        

    

    

        

        

    


Main layout code:




    

    

    


SQL Server Mssql query problem. The column & # 39; & # 39; is invalid in the selection list because it is neither contained in an aggregate function nor in the GROUP BY clause

There is a problem that I experienced in Mssql. (but I do not have this problem in MySQL.) You know two different engines. But I could not find a solution.
Do you think I can fix this error?


My question is

CHOOSE
COUNT (*) as stok_adet, s. *, M. *, D. *
FROM stok as s
CROSS JOIN mermer_cins as m
JOIN stok_durum as d ON s.stok_durum_id = d.stok_durum_id
WO m.mermer_cins_id = & # 39; 5 & # 39; AND s.blok_no = & # 39; M6320 & # 39;
GROUP BY s.bundle_no, s.boy, s.yukseklik, s.hatali
ORDER BY s.blok_no ASC, s.bundle_no ASC, s.stok_tarih DESC " 

And the reason for the error I get in mssql

The column & # 39; stok.stok_id & # 39; is invalid in the selection list because it is neither contained in an aggregate function nor in the GROUP BY clause.


This is the design of my tables in Mssql.

Table mermer_cins => https://pasteboard.co/IofwCGc.jpg
stok table => https://pasteboard.co/Iofx1QV.jpg
stok_durum table => https://pasteboard.co/IofxfJg.jpg

Here is the screenshot link of my running query in MySQL. => https://pasteboard.co/Iof1DVa.png

Collect data for employee performance review using the SharePoint list

I've developed a SharePoint site for performance review.

The site has a custom HTML page with jQuery that creates / updates a record using REST, and this page is blind using the ASPX page. (I'll explain the features used on this page at the end of this question.)

I have granted edit permission to all end users to use the ASPX page to create / update a record in the performance review list. (The validation on custom pages is done manually.)

To hide the performance review list data from end users, I set audience targeting for all members of the performance list view

I feel that I can do something better than I have developed. I need your suggestions to know how to build this better.

I have SharePoint 2013 and SharePoint Online, please suggest for both.

About custom HTML page

It has sections like this,

  • Section 1 Employee Comments
  • Section 1 Self-assessment of employees
  • Section 1 Comments to the Manager
  • Section 1 Manager Rating

such 4 sections are there.
When an employee opens the form, manager columns are hidden with jQuery.
When Manager opens the form, manager columns are displayed and employee columns are read-only using jQuery.

How did I determine when to open the same form as Employees and Managers?

When an employee fills in and submits the form (when a record is created), the designer workflow sends an email to the manager that includes a link with a parameter (employee_unique_id).
jQuery checks if the parameter has been passed so manager-related columns will be opened to be filled in by the manager.

Trigger workflow based on updating the SharePoint list column values

I have a SharePoint Online list of cases that employees need to review on a regular basis. When a case check is complete, employees select "Full" in a drop-down box labeled "Case Checker." I'm trying to create a data flow that sends an email to a specific group if the item "Case Verification" is marked "Full" for an item. I've reviewed templates, but I can not figure out how to set an email to be sent when a field is changed to a specific value. I am very new to SharePoint Online. Does anyone know how to do that?

Many Thanks.

Best approach to designing / displaying dashboards (kpi) using the Sharepoint kpi list

I have a sharepoint list with 70 kpi data points (ie month, destination / destination, actual). What is the best way to display this data in SharePoint.

  1. I tried Excel PowerPivot based on the Sharepoint list, but I could not get it up and running
  2. I tried to point to performance, but I do not have multi-dimension or cube setup for this. The data is stored in the SharePoint list

Please suggest.